Skip to content

Commit 5ed3a44

Browse files
authored
update optional input doc (#34)
1 parent ed0ec3d commit 5ed3a44

File tree

3 files changed

+84
-12
lines changed

3 files changed

+84
-12
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ See [optional inputs](./docs/optional_inputs.md) for descriptions.
150150
- [Optional inputs](./docs/optional_inputs.md)
151151
- [Architecture](./docs/architecture.md)
152152
- [Troubleshooting](./docs/troubleshooting.md)
153-
- [Best practices](./docs/best_practices.md)
154153

155154
## Related Resources
156155

docs/best_practices.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/optional_inputs.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Optional inputs
22

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+
316
`branch` is the branch to source. It defaults to `main`.
417

518
`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,30 +21,98 @@
821

922
`access_logging_bucket` S3 server access logs bucket ARN, enables server access logging on the S3 artifact bucket.
1023

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+
```
1232

1333
`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+
```
1452

1553
`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.
1654

1755
`build_timeout` is the CodeBuild project build timeout. It defaults to 10 (minutes).
1856

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.
2057

2158
`terraform_version` controls the terraform version. It defaults to 1.5.7.
2259

2360
`checkov_version` controls the [Checkov](https://www.checkov.io/) version. It defaults to latest.
2461

2562
`tflint_version` controls the [tflint](https://github.com/terraform-linters/tflint) version. It defaults to 0.48.0.
2663

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+
2786
`vpc` configures the CodeBuild projects to [run in a VPC](https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html).
2887

2988
`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).
3089

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+
31102
`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).
32103

33104
`tagnag_version` controls the [tag-nag](https://github.com/jakebark/tag-nag) version. It defaults to 0.5.8.
34105

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+
36115

116+
`checkov_skip` defines [Checkov](https://www.checkov.io/) skips for the pipeline.
37117

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

Comments
 (0)