|
1 | 1 | # Optional inputs |
2 | 2 |
|
| 3 | +```hcl |
| 4 | +module "pipeline" { |
| 5 | + ... |
| 6 | + branch = "main" |
| 7 | + mode = "SUPERSEDED" |
| 8 | + detect_changes = false |
| 9 | + kms_key = aws_kms_key.this.arn |
| 10 | + access_logging_bucket = aws_s3_bucket.this.id |
| 11 | + artifact_retention = 90 |
| 12 | + log_retention = 90 |
| 13 | +} |
| 14 | +``` |
| 15 | + |
3 | 16 | `branch` is the branch to source. It defaults to `main`. |
4 | 17 |
|
5 | 18 | `mode` is [pipeline execution mode](https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts-how-it-works.html#concepts-how-it-works-executions). It defaults to `SUPERSEDED`.`detect_changes` is used with third-party services, like GitHub. It enables AWS CodeConnections to invoke the pipeline when there is a commit to the repo. It defaults to `false`. |
|
8 | 21 |
|
9 | 22 | `access_logging_bucket` S3 server access logs bucket ARN, enables server access logging on the S3 artifact bucket. |
10 | 23 |
|
11 | | -`artifact_retention` controls the S3 artifact bucket retention period. It defaults to 90 (days). |
| 24 | +`artifact_retention` controls the S3 artifact bucket retention period. It defaults to 90 (days). |
| 25 | + |
| 26 | +```hcl |
| 27 | +module "pipeline" { |
| 28 | + ... |
| 29 | + workspace_directory = "workspaces" |
| 30 | +} |
| 31 | +``` |
12 | 32 |
|
13 | 33 | `workspace_directory` enables the use of workspace variable files (eg ./workspaces/<workspace>.tfvars. The input is the directory name that you wish to use. This input is recommended for advanced variable management, where complex and/or signficant amounts of different variables are applied to different AWS accounts. |
| 34 | +```hcl |
| 35 | +module "pipeline" { |
| 36 | + ... |
| 37 | + codebuild_policy = aws_iam_policy.this.arn |
| 38 | + build_timeout = 10 |
| 39 | + terraform_version = "1.8.0" |
| 40 | + checkov_version = "3.2.0" |
| 41 | + tflint_version = "0.55.0" |
| 42 | +
|
| 43 | + build_override = { |
| 44 | + directory - "./terraform" |
| 45 | + plan_buildspec = file("./my_plan.yml") |
| 46 | + plan_image = "aws/codebuild/amazonlinux2-x86_64-standard:5.0" |
| 47 | + apply_buildspec = file("./my_apply.yml") |
| 48 | + apply_image = "hashicorp/terraform:latest" |
| 49 | + } |
| 50 | +} |
| 51 | +``` |
14 | 52 |
|
15 | 53 | `codebuild_policy` replaces the [AWSAdministratorAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AdministratorAccess.html) IAM policy. This can be used if you want to scope the permissions of the pipeline. |
16 | 54 |
|
17 | 55 | `build_timeout` is the CodeBuild project build timeout. It defaults to 10 (minutes). |
18 | 56 |
|
19 | | -`build_override` can replace the existing CodeBuild buildspecs and images with your own. The `directory` argument sets the path of the terraform (eg. `./terraform`), if its not in the root of your directory structure. |
20 | 57 |
|
21 | 58 | `terraform_version` controls the terraform version. It defaults to 1.5.7. |
22 | 59 |
|
23 | 60 | `checkov_version` controls the [Checkov](https://www.checkov.io/) version. It defaults to latest. |
24 | 61 |
|
25 | 62 | `tflint_version` controls the [tflint](https://github.com/terraform-linters/tflint) version. It defaults to 0.48.0. |
26 | 63 |
|
| 64 | +`build_override` can replace the existing CodeBuild buildspecs and images with your own. The `directory` argument sets the path of the terraform (eg. `./terraform`), if its not in the root of your directory structure. |
| 65 | + |
| 66 | +```hcl |
| 67 | +module "pipeline" { |
| 68 | + ... |
| 69 | + vpc = { |
| 70 | + vpc_id = "vpc-011a22334455bb66c", |
| 71 | + subnets = ["subnet-011aabbcc2233d4ef"], |
| 72 | + security_group_ids = ["sg-001abcd2233ee4455"], |
| 73 | + } |
| 74 | +
|
| 75 | + notifications = { |
| 76 | + sns_topic = aws_sns_topic.this.arn |
| 77 | + detail_type = "BASIC" |
| 78 | + events = [ |
| 79 | + "codepipeline-pipeline-pipeline-execution-failed", |
| 80 | + "codepipeline-pipeline-pipeline-execution-succeeded" |
| 81 | + ] |
| 82 | + } |
| 83 | +} |
| 84 | +``` |
| 85 | + |
27 | 86 | `vpc` configures the CodeBuild projects to [run in a VPC](https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html). |
28 | 87 |
|
29 | 88 | `notifications` creates a [CodeStar notification](https://docs.aws.amazon.com/dtconsole/latest/userguide/welcome.html) for the pipeline. `sns_topic` is the SNS topic arn. `events` are the [notification events](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline). `detail_type` is either BASIC or FULL. The SNS topic must allow [codestar-notifications.amazonaws.com to publush to the topic](https://docs.aws.amazon.com/dtconsole/latest/userguide/notification-target-create.html). |
30 | 89 |
|
| 90 | +```hcl |
| 91 | +module "pipeline" { |
| 92 | + ... |
| 93 | + tags = join(",", [ |
| 94 | + "Environment[Dev,Prod]", |
| 95 | + "Source" |
| 96 | + ]) |
| 97 | + tagnag_version = "0.7.9" |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | + |
31 | 102 | `tags` enables tag validation with [tag-nag](https://github.com/jakebark/tag-nag). Input a list of tag keys and/or tag keys and values to enforce. Input must be passed as a string, see [commands](https://github.com/jakebark/tag-nag?tab=readme-ov-file#commands). |
32 | 103 |
|
33 | 104 | `tagnag_version` controls the [tag-nag](https://github.com/jakebark/tag-nag) version. It defaults to 0.5.8. |
34 | 105 |
|
35 | | -`checkov_skip` defines [Checkov](https://www.checkov.io/) skips for the pipeline. This is useful for organization-wide policies, removing the need to add individual resource skips. |
| 106 | +```hcl |
| 107 | +module "pipeline" { |
| 108 | + ... |
| 109 | + checkov_skip = [ |
| 110 | + "CKV_AWS_144", #Ensure that S3 bucket has cross-region replication enabled |
| 111 | + ] |
| 112 | +} |
| 113 | +``` |
| 114 | + |
36 | 115 |
|
| 116 | +`checkov_skip` defines [Checkov](https://www.checkov.io/) skips for the pipeline. |
37 | 117 |
|
| 118 | +Checkov skips can be used where Checkov policies conflict with your organization's practices or design decisions. The `checkov_skip` module input allows you to set skips for all resources in your repository. For example, if your organization operates in a single region you may want to add `CKV_AWS_144` (Ensure that S3 bucket has cross-region replication enabled). For individual resource skips, you can still use [inline code comments](https://www.checkov.io/2.Basics/Suppressing%20and%20Skipping%20Policies.html). |
0 commit comments