Skip to content

Commit ec658b6

Browse files
authored
tf-ecs-fargate-codepipeline conditional deploys (#40)
* tf-ecs-fargate-codepipeline conditional deploys This changes the `tf-ecs-fargate-lb-service-cicd-codepipeline` template to allow the user to specify which service instances they would like the generated ci/cd pipeline to continuously deploy to. * fixes typo in comment * updates screenshots to show list of instances
1 parent ce29135 commit ec658b6

File tree

6 files changed

+14
-3
lines changed

6 files changed

+14
-3
lines changed

terraform/.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- "--args=--lockfile=false"
1919
- id: terraform_tflint
2020
# ignore until `pipeline_endpoint` is supported
21-
exclude: ./service-templates/tf-lambda-apigw-service-cicd-codepipeline/v1/pipeline_infrastructure/
21+
exclude: ./service-templates/tf-ecs-fargate-lb-service-cicd-codepipeline/v1/pipeline_infrastructure/
2222
args:
2323
- "--args=--only=terraform_deprecated_interpolation"
2424
- "--args=--only=terraform_deprecated_index"

terraform/service-templates/tf-ecs-fargate-lb-service-cicd-codepipeline/v1/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ make template bucket=my-bucket version=1
2727
### Input Parameters
2828

2929
![input](./input.png)
30+
![pipeline](./pipeline.png)
3031

3132

3233
## Security
-63.8 KB
Loading
180 KB
Loading

terraform/service-templates/tf-ecs-fargate-lb-service-cicd-codepipeline/v1/pipeline_infrastructure/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ module "cicd_pipeline" {
3333
repository_id = var.service.repository_id
3434
branch_name = var.service.branch_name
3535

36-
# service instances
37-
service_instances = var.service_instances
36+
# generated pipeline should only deploy to instances specified by user
37+
service_instances = tolist([for i in var.service_instances : i
38+
if contains(var.pipeline.inputs.instances_to_deploy, i.name)])
3839

3940
# pipeline input
4041
service_source_dir = var.pipeline.inputs.service_dir

terraform/service-templates/tf-ecs-fargate-lb-service-cicd-codepipeline/v1/schema/schema.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,29 @@ schema:
5151
type: object
5252
description: "Pipeline input properties"
5353
properties:
54+
instances_to_deploy:
55+
type: array
56+
items:
57+
type: string
58+
title: Instances to deploy
59+
description: Which instances would you like to continuously deploy to
5460
service_dir:
5561
type: string
62+
title: "Source directory for the service"
5663
description: "Source directory for the service"
5764
default: "."
5865
minLength: 1
5966
maxLength: 100
6067
dockerfile:
6168
type: string
69+
title: "Dockerfile location"
6270
description: "The location of the Dockerfile to build"
6371
default: "Dockerfile"
6472
minLength: 1
6573
maxLength: 100
6674
unit_test_command:
6775
type: string
76+
title: "Unit test command"
6877
description: "The command to run to unit test the application code"
6978
default: "echo 'add your unit test command here'"
7079
minLength: 1

0 commit comments

Comments
 (0)