-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PLT-355 switch resource block to data block #96
Conversation
terraform/modules/bucket/main.tf
Outdated
versioning_configuration { | ||
status = "Enabled" | ||
} | ||
data "aws_s3_bucket" "bucket-access_logs" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data "aws_s3_bucket" "bucket-access_logs" { | |
data "aws_s3_bucket" "bucket_access_logs" { |
terraform/modules/bucket/outputs.tf
Outdated
output "access_log_bucket_arn" { | ||
description = "The ARN of the access log S3 bucket" | ||
value = data.aws_s3_bucket.bucket-access_logs.arn | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these outputs
terraform/modules/bucket/main.tf
Outdated
target_bucket = aws_s3_bucket.access_logs.id | ||
target_prefix = "log/" | ||
target_bucket = data.aws_s3_bucket.bucket-access_logs.id | ||
target_prefix = "${var.name}/log/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_prefix = "${var.name}/log/" | |
target_prefix = "${var.name}/" |
Looks good! We'll have to get #95 merged and applied before we get good plan checks here. |
terraform/modules/bucket/main.tf
Outdated
status = "Enabled" | ||
} | ||
data "aws_s3_bucket" "bucket_access_logs" { | ||
bucket = "${var.app}-${var.env}-bucket-access-log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the change suggested in https://github.com/CMSgov/ab2d-bcda-dpc-platform/pull/95/files#r1674341305 we'll be able to drop app and env variables and reference the account ID as we did there.
terraform/modules/function/main.tf
Outdated
@@ -145,6 +145,7 @@ module "zip_bucket" { | |||
"arn:aws:iam::${data.aws_ssm_parameter.prod_account[0].value}:role/delegatedadmin/developer/${var.app}-prod-github-actions", | |||
"arn:aws:iam::${data.aws_ssm_parameter.sbx_account[0].value}:role/delegatedadmin/developer/${var.app}-sbx-github-actions", | |||
] : [] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to nit pick but could this blank line addition be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line addition has been removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Let's monitor the apply jobs
🎫 Ticket
PLT-355
🛠 Changes
Resource block for access-log removed and data block added to reference access log bucket
ℹ️ Context
Our shared terraform currently creates an access log bucket for each bucket. We've recently hit the 100-bucket limit in the BCDA account (quota increase pending) so there is a reason not to create buckets unnecessarily. A terraform service for an access-log-bucket was created and points all bucket-logging to prefixes within that bucket.
🧪 Validation
terraform ran locally. only error was Error: reading S3 Bucket (bcda-access-logs): couldn't find resource because infra creating access log bucket is yet to be deployed and is being use here as a data block.
all workflows fail due to the fact that the data source being used is yet to be deployed and so terraform can't find centralized bucket