Skip to content

Commit 734b108

Browse files
committed
ci: Added new input variables.
1 parent 8cec2fa commit 734b108

File tree

7 files changed

+62
-34
lines changed

7 files changed

+62
-34
lines changed

.github/workflows/branch.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@ jobs:
9595
steps:
9696
- name: Checkout source code
9797
uses: actions/checkout@v4
98-
- name: GHAS not enabled warning
99-
if: ${{ !github.event.repository.security_and_analysis.advanced_security_enabled && github.event.repository.private }}
100-
run: |
101-
echo "Warning: GitHub Advanced Security is not enabled. Please enable it to upload SARIF results."
102-
- name: GHAS enabled notice
103-
if: ${{ github.event.repository.security_and_analysis.advanced_security_enabled || !github.event.repository.private }}
104-
run: |
105-
echo "GitHub Advanced Security is enabled. SARIF results will be uploaded to the Security tab on the main branch."
10698
- name: Run Trivy vulnerability scanner
10799
uses: aquasecurity/[email protected]
108100
with:

.github/workflows/deploy.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ jobs:
3636
AWS_REGION: ${{ secrets.AWS_REGION }}
3737
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
3838
TF_VAR_APPLY_DATABASE_UPDATES_IMMEDIATELY: ${{ secrets.TF_VAR_APPLY_DATABASE_UPDATES_IMMEDIATELY }}
39+
TF_VAR_CONSUMER_CONTAINER_COUNT: ${{ secrets.TF_VAR_CONSUMER_CONTAINER_COUNT }}
3940
TF_VAR_DATABASE_SKIP_FINAL_SNAPSHOT: ${{ secrets.TF_VAR_DATABASE_SKIP_FINAL_SNAPSHOT }}
4041
TF_VAR_DELETION_PROTECTION: ${{ secrets.TF_VAR_DELETION_PROTECTION }}
4142
TF_VAR_ENVIRONMENT: ${{ secrets.TF_VAR_ENVIRONMENT }}
4243
TF_VAR_EXPORT_EXPIRATION: ${{ secrets.TF_VAR_EXPORT_EXPIRATION }}
44+
TF_VAR_IMAGE_TAGS_MUTABLE: ${{ secrets.TF_VAR_IMAGE_TAGS_MUTABLE }}
4345
TF_VAR_KEY_RECOVERY_PERIOD: ${{ secrets.TF_VAR_KEY_RECOVERY_PERIOD }}
4446
TF_VAR_PROGRAM: ${{ secrets.TF_VAR_PROGRAM }}
4547
TF_VAR_PROJECT: ${{ secrets.TF_VAR_PROJECT }}
@@ -80,19 +82,22 @@ jobs:
8082
# For any of these that have a value, the corresponding TF_VAR_*
8183
# environment variable will be set.
8284
APPLY_DATABASE_UPDATES_IMMEDIATELY: ${{ secrets.TF_VAR_APPLY_DATABASE_UPDATES_IMMEDIATELY }}
85+
CONSUMER_CONTAINER_COUNT: ${{ secrets.TF_VAR_CONSUMER_CONTAINER_COUNT }}
8386
DATABASE_SKIP_FINAL_SNAPSHOT: ${{ secrets.TF_VAR_DATABASE_SKIP_FINAL_SNAPSHOT }}
8487
DELETION_PROTECTION: ${{ secrets.TF_VAR_DELETION_PROTECTION }}
8588
ENVIRONMENT: ${{ secrets.TF_VAR_ENVIRONMENT }}
8689
EXPORT_EXPIRATION: ${{ secrets.TF_VAR_EXPORT_EXPIRATION }}
90+
IMAGE_TAGS_MUTABLE: ${{ secrets.TF_VAR_IMAGE_TAGS_MUTABLE }}
8791
KEY_RECOVERY_PERIOD: ${{ secrets.TF_VAR_KEY_RECOVERY_PERIOD }}
8892
PROGRAM: ${{ secrets.TF_VAR_PROGRAM }}
8993
PROJECT: ${{ secrets.TF_VAR_PROJECT }}
9094
REPOSITORY: ${{ secrets.TF_VAR_REPOSITORY }}
9195
run: |
9296
variables=(
93-
"apply_database_updates_immediately" "database_skip_final_snapshot"
94-
"deletion_protection" "environment" "export_expiration"
95-
"key_recovery_period" "program" "project" "repository"
97+
"apply_database_updates_immediately" "consumer_container_count"
98+
"database_skip_final_snapshot" "deletion_protection" "environment"
99+
"export_expiration" "image_tags_mutable" "key_recovery_period"
100+
"program" "project" "repository"
96101
)
97102
for var in ${variables[@]}; do
98103
name="$(echo $var | tr '[:lower:]' '[:upper:]')"

.github/workflows/plan.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
AWS_ROLE_ARN:
1919
TF_VAR_APPLY_DATABASE_UPDATES_IMMEDIATELY:
2020
required: false
21+
TF_VAR_CONSUMER_CONTAINER_COUNT:
22+
required: false
2123
TF_VAR_DATABASE_SKIP_FINAL_SNAPSHOT:
2224
required: false
2325
TF_VAR_DELETION_PROTECTION:
@@ -26,6 +28,8 @@ on:
2628
required: false
2729
TF_VAR_EXPORT_EXPIRATION:
2830
required: false
31+
TF_VAR_IMAGE_TAGS_MUTABLE:
32+
required: false
2933
TF_VAR_KEY_RECOVERY_PERIOD:
3034
required: false
3135
TF_VAR_PROGRAM:
@@ -90,19 +94,22 @@ jobs:
9094
# For any of these that have a value, the corresponding TF_VAR_*
9195
# environment variable will be set.
9296
APPLY_DATABASE_UPDATES_IMMEDIATELY: ${{ secrets.TF_VAR_APPLY_DATABASE_UPDATES_IMMEDIATELY }}
97+
CONSUMER_CONTAINER_COUNT: ${{ secrets.TF_VAR_CONSUMER_CONTAINER_COUNT }}
9398
DATABASE_SKIP_FINAL_SNAPSHOT: ${{ secrets.TF_VAR_DATABASE_SKIP_FINAL_SNAPSHOT }}
9499
DELETION_PROTECTION: ${{ secrets.TF_VAR_DELETION_PROTECTION }}
95100
ENVIRONMENT: ${{ secrets.TF_VAR_ENVIRONMENT }}
96101
EXPORT_EXPIRATION: ${{ secrets.TF_VAR_EXPORT_EXPIRATION }}
102+
IMAGE_TAGS_MUTABLE: ${{ secrets.TF_VAR_IMAGE_TAGS_MUTABLE }}
97103
KEY_RECOVERY_PERIOD: ${{ secrets.TF_VAR_KEY_RECOVERY_PERIOD }}
98104
PROGRAM: ${{ secrets.TF_VAR_PROGRAM }}
99105
PROJECT: ${{ secrets.TF_VAR_PROJECT }}
100106
REPOSITORY: ${{ secrets.TF_VAR_REPOSITORY }}
101107
run: |
102108
variables=(
103-
"apply_database_updates_immediately" "database_skip_final_snapshot"
104-
"deletion_protection" "environment" "export_expiration"
105-
"key_recovery_period" "program" "project" "repository"
109+
"apply_database_updates_immediately" "consumer_container_count"
110+
"database_skip_final_snapshot" "deletion_protection" "environment"
111+
"export_expiration" "image_tags_mutable" "key_recovery_period"
112+
"program" "project" "repository"
106113
)
107114
for var in ${variables[@]}; do
108115
name="$(echo $var | tr '[:lower:]' '[:upper:]')"

tofu/config/service/main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ module "inputs" {
1818
module "system" {
1919
source = "../../modules/system"
2020

21-
environment = var.environment
22-
project = var.project
23-
export_expiration = var.export_expiration
24-
key_recovery_period = var.key_recovery_period
25-
logging_bucket = module.inputs.values["logging/bucket"]
26-
logging_key_arn = module.inputs.values["logging/key"]
27-
tags = merge({ awsApplication : module.inputs.values["application/tag"] }, var.tags)
28-
vpc_id = module.inputs.values["vpc/id"]
29-
database_subnets = split(",", module.inputs.values["vpc/private_subnets"])
30-
container_subnets = split(",", module.inputs.values["vpc/private_subnets"])
21+
environment = var.environment
22+
project = var.project
23+
export_expiration = var.export_expiration
24+
key_recovery_period = var.key_recovery_period
25+
logging_bucket = module.inputs.values["logging/bucket"]
26+
logging_key_arn = module.inputs.values["logging/key"]
27+
tags = merge({ awsApplication : module.inputs.values["application/tag"] }, var.tags)
28+
vpc_id = module.inputs.values["vpc/id"]
29+
database_subnets = split(",", module.inputs.values["vpc/private_subnets"])
30+
container_subnets = split(",", module.inputs.values["vpc/private_subnets"])
31+
consumer_container_count = var.consumer_container_count
32+
image_tags_mutable = var.image_tags_mutable
3133

3234
apply_database_updates_immediately = var.apply_database_updates_immediately
3335
database_skip_final_snapshot = var.database_skip_final_snapshot

tofu/config/service/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "apply_database_updates_immediately" {
44
default = false
55
}
66

7+
variable "consumer_container_count" {
8+
type = number
9+
description = "Number of containers to run persistently for the consumer service."
10+
default = 1
11+
}
12+
713
variable "database_skip_final_snapshot" {
814
type = bool
915
description = "Whether to skip the final snapshot when the database cluster is deleted."
@@ -28,6 +34,12 @@ variable "export_expiration" {
2834
description = "Number of days before export files expire."
2935
}
3036

37+
variable "image_tags_mutable" {
38+
type = bool
39+
description = "Whether to allow image tags to be mutable."
40+
default = false
41+
}
42+
3143
variable "key_recovery_period" {
3244
type = number
3345
default = 30

tofu/modules/system/ecs.tf

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ module "ecs" {
4747
}
4848

4949
module "tools" {
50-
source = "../ephemeral_service"
50+
source = "../ephemeral_service"
51+
depends_on = [aws_iam_policy.secrets]
5152

5253
environment = var.environment
5354
project = var.project
5455
service = "tools"
5556
execution_policies = [aws_iam_policy.secrets.arn]
56-
57-
# Until we get the database initialized.
58-
image_tags_mutable = true
57+
image_tags_mutable = var.image_tags_mutable
5958

6059
environment_variables = {
6160
PGHOST : module.database.cluster_endpoint
@@ -70,14 +69,15 @@ module "tools" {
7069
SENZING_ENGINE_CONFIGURATION_JSON = module.senzing_config.ssm_parameter_arn
7170
}
7271

73-
# TODO: Do we need these?
72+
# TODO: Do we need this?
7473
logging_key_id = var.logging_key_arn
7574

7675
tags = var.tags
7776
}
7877

7978
module "consumer" {
80-
source = "../fargate_service"
79+
source = "../fargate_service"
80+
depends_on = [aws_iam_policy.queue, aws_iam_policy.secrets]
8181

8282
environment = var.environment
8383
project = var.project
@@ -88,10 +88,8 @@ module "consumer" {
8888
logging_key_id = var.logging_key_arn
8989
cluster_arn = module.ecs.arn
9090
security_groups = [module.task_security_group.security_group_id]
91-
92-
# TODO: Until we get the database initialized.
93-
desired_containers = 1
94-
image_tags_mutable = true
91+
desired_containers = var.consumer_container_count
92+
image_tags_mutable = var.image_tags_mutable
9593

9694
environment_variables = {
9795
Q_URL : module.sqs.queue_url

tofu/modules/system/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "apply_database_updates_immediately" {
44
default = false
55
}
66

7+
variable "consumer_container_count" {
8+
type = number
9+
description = "Number of containers to run persistently for the consumer service."
10+
default = 1
11+
}
12+
713
variable "container_subnets" {
814
description = "The IDs of the subnets in which the container resources should be deployed."
915
type = list(string)
@@ -83,6 +89,12 @@ variable "export_lock_period" {
8389
}
8490
}
8591

92+
variable "image_tags_mutable" {
93+
type = bool
94+
description = "Whether to allow image tags to be mutable."
95+
default = false
96+
}
97+
8698
variable "key_recovery_period" {
8799
type = number
88100
default = 30

0 commit comments

Comments
 (0)