-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Summary Relates to #3160 ### Time to review: __2 mins__ ## Changes proposed - Writes the iterative s3 bucket ids and arns to ssm params - Reads the api's variants of those ssm params into the analytics application - Gives the analytics application access to the api's s3 buckets ##⚠️ Deploy Warning⚠️ This creates a dependency between the API infra and Analytics infra. Because of this, there will be a race condition between the two deployments. If a deploy is broken, then the fix is just to deploy again.
- Loading branch information
1 parent
5880f47
commit 1afd3d4
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
data "aws_ssm_parameter" "transfer_bucket_arn" { | ||
name = "/buckets/api-${var.environment_name}/api-analytics-transfer/arn" | ||
} | ||
|
||
data "aws_ssm_parameter" "transfer_bucket_id" { | ||
name = "/buckets/api-${var.environment_name}/api-analytics-transfer/id" | ||
} | ||
|
||
data "aws_iam_policy_document" "transfer_bucket_access" { | ||
statement { | ||
effect = "Allow" | ||
resources = [ | ||
data.aws_ssm_parameter.transfer_bucket_arn.value, | ||
"${data.aws_ssm_parameter.transfer_bucket_arn.value}/*", | ||
] | ||
actions = ["s3:Get*", "s3:List*"] | ||
|
||
principals { | ||
type = "AWS" | ||
identifiers = [module.service.app_service_arn] | ||
} | ||
} | ||
} | ||
|
||
resource "aws_s3_bucket_policy" "transfer_bucket_access" { | ||
bucket = data.aws_ssm_parameter.transfer_bucket_id.value | ||
policy = data.aws_iam_policy_document.transfer_bucket_access.json | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters