Skip to content

Commit

Permalink
Merge pull request #9041 from ministryofjustice/Update_101224_3
Browse files Browse the repository at this point in the history
Update_101224_3
  • Loading branch information
nbuckingham72 authored Dec 10, 2024
2 parents fefafa2 + e3180e8 commit 38ae17e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
17 changes: 7 additions & 10 deletions terraform/environments/ppud/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1204,16 +1204,6 @@ resource "aws_iam_policy" "iam_policy_for_lambda_cloudwatch_get_metric_data_dev"
"arn:aws:ssm:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:parameter/klayers-account"
]
},
{
"Sid" : "EC2Policy",
"Effect" : "Allow",
"Action" : [
"ec2:DescribeInstances"
],
"Resource" : [
"arn:aws:ec2:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*"
]
},
{
"Sid" : "LogPolicy",
"Effect" : "Allow",
Expand Down Expand Up @@ -1277,6 +1267,13 @@ resource "aws_iam_policy_attachment" "attach_lambda_cloudwatch_full_access_dev"
policy_arn = "arn:aws:iam::aws:policy/CloudWatchFullAccessV2"
}

resource "aws_iam_policy_attachment" "attach_lambda_ec2_read_only_access_dev" {
count = local.is-development == true ? 1 : 0
name = "lambda-ec2-read-only-access-iam-attachment"
roles = [aws_iam_role.lambda_role_cloudwatch_get_metric_data_dev[0].id]
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess"
}

#resource "aws_iam_policy_attachment" "attach_ses_full_access" {
# count = local.is-development == true ? 1 : 0
# name = "ses-full-access-iam-attachment"
Expand Down
6 changes: 3 additions & 3 deletions terraform/environments/ppud/instances.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ resource "aws_instance" "s609693lo6vw102" {
instance_type = "m5.large"
source_dest_check = false
iam_instance_profile = aws_iam_instance_profile.ec2_profile.id
vpc_security_group_ids = [aws_security_group.Secondary-DOC-Server[0].id]
vpc_security_group_ids = [aws_security_group.Live-DOC-Server[0].id]
subnet_id = data.aws_subnet.private_subnets_c.id

metadata_options {
Expand All @@ -116,7 +116,7 @@ resource "aws_instance" "s609693lo6vw103" {
instance_type = "m5.large"
source_dest_check = false
iam_instance_profile = aws_iam_instance_profile.ec2_profile.id
vpc_security_group_ids = [aws_security_group.Primary-DOC-Server[0].id]
vpc_security_group_ids = [aws_security_group.Archive-DOC-Server[0].id]
subnet_id = data.aws_subnet.private_subnets_b.id

metadata_options {
Expand Down Expand Up @@ -599,7 +599,7 @@ resource "aws_instance" "s618358rgvw022" {
instance_type = "m5.xlarge"
source_dest_check = false
iam_instance_profile = aws_iam_instance_profile.ec2_profile.id
vpc_security_group_ids = [aws_security_group.Primary-DOC-Server[0].id]
vpc_security_group_ids = [aws_security_group.Archive-DOC-Server[0].id]
subnet_id = data.aws_subnet.private_subnets_b.id

metadata_options {
Expand Down
1 change: 1 addition & 0 deletions terraform/environments/ppud/security_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ resource "aws_security_group_rule" "Dev-Servers-Standard-Egress-2" {
# Production

resource "aws_security_group" "Primary-DOC-Server" {
# checkov:skip=CKV2_AWS_5: "Temporarily unattached to any EC2 instances"
count = local.is-preproduction == false ? 1 : 0
vpc_id = data.aws_vpc.shared.id
name = "Primary-DOC-Server"
Expand Down

0 comments on commit 38ae17e

Please sign in to comment.