Skip to content

Commit 2e4992b

Browse files
committed
Permissions and naming
1 parent 0586dbd commit 2e4992b

File tree

7 files changed

+68
-11
lines changed

7 files changed

+68
-11
lines changed

infra/roles.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ resource "aws_iam_role" "auto_ops" {
5959
AWS = "arn:aws:iam::${var.build_agent_account_id}:role/build-agent"
6060
},
6161
Action = "sts:AssumeRole"
62+
},
63+
{
64+
Sid = ""
65+
Effect = "Allow",
66+
Principal = {
67+
AWS = "arn:aws:iam::${var.imms_account_id}:role/DevOps"
68+
},
69+
Action = "sts:AssumeRole"
6270
}
6371
]
6472
})

infra_old_prod/kms_dynamo.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ resource "aws_kms_key" "dynamodb_encryption" {
5050
],
5151
"Resource": "*"
5252
},
53-
{
53+
{
54+
"Sid": "KMS KeyUser access for Admin",
55+
"Effect": "Allow",
56+
"Principal": { "AWS": ["arn:aws:iam::084828561157:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_PREPROD-IMMS-Admin_acce656dcacf6f4c"] },
57+
"Action": [
58+
"kms:Encrypt",
59+
"kms:GenerateDataKey*"
60+
],
61+
"Resource": "*"
62+
},
63+
{
5464
"Sid": "AllowAccountA",
5565
"Effect": "Allow",
5666
"Principal": {

infra_old_prod/kms_kinesis.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ resource "aws_kms_key" "kinesis_stream_encryption" {
4949
"kms:GenerateDataKey*"
5050
],
5151
"Resource": "*"
52+
},
53+
{
54+
"Sid": "KMS KeyUser access for Admin",
55+
"Effect": "Allow",
56+
"Principal": { "AWS": ["arn:aws:iam::084828561157:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_PREPROD-IMMS-Admin_acce656dcacf6f4c"] },
57+
"Action": [
58+
"kms:Encrypt",
59+
"kms:GenerateDataKey*"
60+
],
61+
"Resource": "*"
5262
}
5363
]
5464
}

infra_old_prod/kms_lambda.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ resource "aws_kms_key" "lambda_env_encryption" {
4949
"kms:GenerateDataKey*"
5050
],
5151
"Resource": "*"
52+
},
53+
{
54+
"Sid": "KMS KeyUser access for Admin",
55+
"Effect": "Allow",
56+
"Principal": { "AWS": ["arn:aws:iam::084828561157:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_PREPROD-IMMS-Admin_acce656dcacf6f4c"] },
57+
"Action": [
58+
"kms:Encrypt",
59+
"kms:GenerateDataKey*"
60+
],
61+
"Resource": "*"
5262
}
5363
]
5464
}

infra_old_prod/kms_s3.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ resource "aws_kms_key" "s3_shared_key" {
4141
"kms:GenerateDataKey*"
4242
],
4343
"Resource": "*"
44-
}
44+
},
45+
{
46+
"Sid": "KMS KeyUser access for Admin",
47+
"Effect": "Allow",
48+
"Principal": { "AWS": ["arn:aws:iam::084828561157:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_PREPROD-IMMS-Admin_acce656dcacf6f4c"] },
49+
"Action": [
50+
"kms:Encrypt",
51+
"kms:GenerateDataKey*"
52+
],
53+
"Resource": "*"
54+
}
4555
]
4656
}
4757
POLICY

infra_old_prod/roles.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ resource "aws_iam_role" "auto_ops" {
5959
AWS = "arn:aws:iam::${var.build_agent_account_id}:role/build-agent"
6060
},
6161
Action = "sts:AssumeRole"
62+
},
63+
{
64+
Sid = ""
65+
Effect = "Allow",
66+
Principal = {
67+
AWS = "arn:aws:iam::${var.imms_account_id}:role/DevOps"
68+
},
69+
Action = "sts:AssumeRole"
6270
}
6371
]
6472
})

terraform_old/variables.tf

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ variable "profile" {
22
default = "apim-dev"
33
}
44
variable "aws_account_name" {
5-
default = "non-prod"
5+
default = "int"
66
}
77
variable "project_name" {
8-
default = "immunisations"
8+
default = "immunisation"
99
}
1010

1111
variable "project_short_name" {
@@ -19,7 +19,7 @@ variable "service" {
1919
data "aws_vpc" "default" {
2020
filter {
2121
name = "tag:Name"
22-
values = [local.vpc_name]
22+
values = ["imms-${var.aws_account_name}-fhir-api-vpc"]
2323
}
2424
}
2525

@@ -38,18 +38,19 @@ locals {
3838
project_domain_name = data.aws_route53_zone.project_zone.name
3939
}
4040

41+
4142
locals {
43+
local_config = "int"
4244
environment = var.aws_account_name
4345
env = terraform.workspace
44-
prefix = "${var.project_name}-${var.service}-${local.env}"
45-
short_prefix = "${var.project_short_name}-${local.env}"
46-
batch_prefix = "immunisation-batch-${local.env}"
47-
service_domain_name = "${local.env}.${local.project_domain_name}"
4846
config_env = local.environment
49-
vpc_name = "imms-${local.config_env}-fhir-api-vpc"
47+
prefix = "${var.project_name}-${var.service}-${local.env}-${local.local_config}"
48+
short_prefix = "${var.project_short_name}-${local.env}-${local.local_config}"
49+
batch_prefix = "immunisation-batch-${local.env}-${local.local_config}"
50+
service_domain_name = "${local.env}.${local.project_domain_name}"
5051
immunisation_account_id = "084828561157"
5152
dspp_core_account_id = "603871901111"
52-
local_config = "int"
53+
5354
tags = {
5455
Project = var.project_name
5556
Environment = local.environment

0 commit comments

Comments
 (0)