Skip to content

Commit fc89bce

Browse files
committed
move CLOUDFRONT_VERIFY to secrets
1 parent 762b4a3 commit fc89bce

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

tf/cloudfront.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,8 @@ resource "aws_cloudfront_distribution" "main" {
131131
resource "random_bytes" "cloudfront_verify" {
132132
length = 32
133133
}
134+
resource "aws_ssm_parameter" "cloudfront_verify" {
135+
name = "${var.ssm_parameter_prefix}X_CLOUDFRONT_VERIFY"
136+
type = "SecureString"
137+
value = random_bytes.cloudfront_verify.base64
138+
}

tf/iam_EcsExecSponsorApp.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ data "aws_iam_policy_document" "EcsExecSponsorApp" {
6262
actions = [
6363
"ssm:GetParameters",
6464
]
65-
resources = ["arn:aws:ssm:*:${data.aws_caller_identity.current.account_id}:parameter/sponsor-app/*"]
65+
resources = ["arn:aws:ssm:*:${data.aws_caller_identity.current.account_id}:parameter${var.ssm_parameter_prefix}*"]
6666
}
6767
statement {
6868
effect = "Allow"

tf/locals.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ locals {
2222
# Conditional: SQS (only when enabled)
2323
JOB_ADAPTER = var.enable_sqs ? "lambdakiq" : "inline"
2424
LAMBDAKIQ_QUEUE = var.enable_sqs ? aws_sqs_queue.lambdakiq[0].name : ""
25-
26-
CLOUDFRONT_VERIFY = random_bytes.cloudfront_verify.base64
2725
}
2826

2927
# Empty for now, will be populated when SSM parameters are migrated to Terraform
30-
default_secrets = {}
28+
default_secrets = {
29+
CLOUDFRONT_VERIFY = aws_ssm_parameter.cloudfront_verify.arn
30+
}
3131

3232
# Transform secrets to SSM_SECRET__ environment variables for dynamic loading
3333
secret_loader_environments = {

tf/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ variable "github_actions_sub" {
103103
description = "GitHub Actions OIDC subject for deployment role"
104104
}
105105

106+
variable "ssm_parameter_prefix" {
107+
type = string
108+
description = "Prefix for SSM parameter paths (include leading/trailing slashes)"
109+
}
110+
106111
variable "environments" {
107112
type = map(string)
108113
default = {}

0 commit comments

Comments
 (0)