Skip to content

Commit de29e07

Browse files
Update site S3 bucket name to reduce chance of collision
1 parent b878ca1 commit de29e07

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.github/workflows/client-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ jobs:
106106
env:
107107
TARGET_ENV: ${{ env.TARGET_ENV }}
108108
run: |
109-
aws s3 sync client/wfprev-war/src/main/angular/dist/wfprev s3://wfprev-${{ steps.mapEnvironments.outputs.SHORTENED_ENV }}-site \
109+
aws s3 sync client/wfprev-war/src/main/angular/dist/wfprev s3://wfprev-${{vars.TFC_PROJECT}}-${{ steps.mapEnvironments.outputs.SHORTENED_ENV }}-site \
110110
--delete \
111111
--cache-control max-age=31536000,public \
112112
--exclude index.html
113-
aws s3 cp client/wfprev-war/src/main/angular/dist/wfprev/index.html s3://wfprev-${{ steps.mapEnvironments.outputs.SHORTENED_ENV }}-site/index.html \
113+
aws s3 cp client/wfprev-war/src/main/angular/dist/wfprev/index.html s3://wfprev-${{vars.TFC_PROJECT}}-${{ steps.mapEnvironments.outputs.SHORTENED_ENV }}-site/index.html \
114114
--cache-control max-age=0,no-cache,no-store,must-revalidate
115115
116116
- name: Invalidate CloudFront Cache

terraform/s3.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module "s3_secure_bucket" {
33
source = "git::https://github.com/bcgov/quickstart-aws-helpers.git//terraform/modules/s3-secure-bucket?ref=v0.0.5"
44

5-
bucket_name = "wfprev-${var.SHORTENED_ENV}-site"
5+
bucket_name = "wfprev-${var.TFC_PROJECT}-${var.SHORTENED_ENV}-site"
66
force_destroy = true
77

88
# S3 Bucket Policy for public access
@@ -15,7 +15,7 @@ module "s3_secure_bucket" {
1515
"AWS" : "${aws_cloudfront_origin_access_identity.oai.iam_arn}"
1616
},
1717
Action = "s3:GetObject",
18-
Resource = "arn:aws:s3:::wfprev-${var.SHORTENED_ENV}-site/*"
18+
Resource = "arn:aws:s3:::wfprev-${var.TFC_PROJECT}-${var.SHORTENED_ENV}-site/*"
1919
},
2020
{
2121
Effect = "Allow",
@@ -29,8 +29,8 @@ module "s3_secure_bucket" {
2929
"s3:DeleteObject"
3030
],
3131
Resource = [
32-
"arn:aws:s3:::wfprev-${var.SHORTENED_ENV}-site",
33-
"arn:aws:s3:::wfprev-${var.SHORTENED_ENV}-site/*"
32+
"arn:aws:s3:::wfprev-${var.TFC_PROJECT}-${var.SHORTENED_ENV}-site",
33+
"arn:aws:s3:::wfprev-${var.TFC_PROJECT}-${var.SHORTENED_ENV}-site/*"
3434
]
3535
}
3636
]

terraform/terragrunt.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ generate "tfvars" {
2727
TARGET_ENV = "${get_env("TARGET_ENV")}"
2828
NAMESPACE_ENV = "${get_env("NAMESPACE_ENV")}"
2929
SHORTENED_ENV = "${get_env("SHORTENED_ENV")}"
30+
TFC_PROJECT = "${get_env("TFC_PROJECT")}"
3031
APP_COUNT = "${get_env("APP_COUNT")}"
3132
LOGGING_LEVEL = "${get_env("LOGGING_LEVEL")}"
3233
RESTORE_DOWNSCALED_CLUSTER = "${get_env("RESTORE_DOWNSCALED_CLUSTER")}"

terraform/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ variable "SHORTENED_ENV" {
2020
type = string
2121
}
2222

23+
variable "TFC_PROJECT" {
24+
description = "License Plate number of project"
25+
type = string
26+
}
27+
2328
variable "WFPREV_API_CPU_UNITS" {
2429
description = "server CPU units to provision (1 vCPU = 1024 CPU units)"
2530
type = number

0 commit comments

Comments
 (0)