Skip to content

Commit f53ff43

Browse files
committed
context.tf updated to v0.24.1, minimum required Terraform version bumped to 0.13.0 when needed, readme updated
1 parent 7d71374 commit f53ff43

File tree

13 files changed

+183
-60
lines changed

13 files changed

+183
-60
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
# Cloud Posse must review any changes to standard context definition,
1717
# but some changes can be rubber-stamped.
18-
**/context.tf @cloudposse/engineering @cloudposse/approvers
19-
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
20-
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
18+
**/*.tf @cloudposse/engineering @cloudposse/approvers
19+
README.yaml @cloudposse/engineering @cloudposse/approvers
20+
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
21+
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
2122

2223
# Cloud Posse Admins must review all changes to CODEOWNERS or the mergify configuration
2324
.github/mergify.yml @cloudposse/admins

.github/auto-release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ change-template: |
4343
4444
template: |
4545
$CHANGES
46+
47+
replacers:
48+
# Remove irrelevant information from Renovate bot
49+
- search: '/---\s+^#.*Renovate configuration(?:.|\n)*?This PR has been generated .*/gm'
50+
replace: ''
51+
# Remove Renovate bot banner image
52+
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
53+
replace: ''

.github/mergify.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
# https://docs.mergify.io/conditions.html
2+
# https://docs.mergify.io/actions.html
13
pull_request_rules:
24
- name: "approve automated PRs that have passed checks"
35
conditions:
4-
- "check-success~=test/bats"
5-
- "check-success~=test/readme"
6-
- "check-success~=test/terratest"
6+
- "author~=^(cloudpossebot|renovate\\[bot\\])$"
77
- "base=master"
8-
- "author=cloudpossebot"
9-
- "head~=auto-update/.*"
8+
- "-closed"
9+
- "head~=^(auto-update|renovate)/.*"
10+
- "check-success=test/bats"
11+
- "check-success=test/readme"
12+
- "check-success=test/terratest"
13+
- "check-success=validate-codeowners"
1014
actions:
1115
review:
1216
type: "APPROVE"
@@ -15,16 +19,17 @@ pull_request_rules:
1519

1620
- name: "merge automated PRs when approved and tests pass"
1721
conditions:
18-
- "check-success~=test/bats"
19-
- "check-success~=test/readme"
20-
- "check-success~=test/terratest"
22+
- "author~=^(cloudpossebot|renovate\\[bot\\])$"
2123
- "base=master"
22-
- "head~=auto-update/.*"
24+
- "-closed"
25+
- "head~=^(auto-update|renovate)/.*"
26+
- "check-success=test/bats"
27+
- "check-success=test/readme"
28+
- "check-success=test/terratest"
29+
- "check-success=validate-codeowners"
2330
- "#approved-reviews-by>=1"
2431
- "#changes-requested-reviews-by=0"
2532
- "#commented-reviews-by=0"
26-
- "base=master"
27-
- "author=cloudpossebot"
2833
actions:
2934
merge:
3035
method: "squash"
@@ -38,6 +43,7 @@ pull_request_rules:
3843
- name: "ask to resolve conflict"
3944
conditions:
4045
- "conflict"
46+
- "-closed"
4147
actions:
4248
comment:
4349
message: "This pull request is now in conflict. Could you fix it @{{author}}? 🙏"

.github/renovate.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": [
3+
"config:base",
4+
":preserveSemverRanges"
5+
],
6+
"labels": ["auto-update"],
7+
"enabledManagers": ["terraform"],
8+
"terraform": {
9+
"ignorePaths": ["**/context.tf", "examples/**"]
10+
}
11+
}
12+

.github/workflows/auto-context.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ jobs:
2727
make init
2828
make github/init/context.tf
2929
make readme/build
30-
echo "::set-output name=create_pull_request=true"
30+
echo "::set-output name=create_pull_request::true"
3131
fi
3232
else
3333
echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates."
3434
fi
3535
3636
- name: Create Pull Request
37-
if: {{ steps.update.outputs.create_pull_request == 'true' }}
37+
if: steps.update.outputs.create_pull_request == 'true'
3838
uses: cloudposse/actions/github/create-pull-request@0.22.0
3939
with:
4040
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
41+
committer: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>'
42+
author: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>'
4143
commit-message: Update context.tf from origin source
4244
title: Update context.tf
4345
body: |-

.github/workflows/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- master
77

88
jobs:
9-
semver:
9+
publish:
1010
runs-on: ubuntu-latest
1111
steps:
1212
# Drafts your next Release notes as Pull Requests are merged into "master"

.github/workflows/validate-codeowners.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ jobs:
99
- name: "Checkout source code at current commit"
1010
uses: actions/checkout@v2
1111
- uses: mszostok/codeowners-validator@v0.5.0
12+
if: github.event.pull_request.head.repo.full_name == github.repository
13+
name: "Full check of CODEOWNERS"
1214
with:
1315
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
1416
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
1517
# checks: "files,syntax,owners,duppatterns"
1618
checks: "syntax,owners,duppatterns"
1719
# GitHub access token is required only if the `owners` check is enabled
1820
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
21+
- uses: mszostok/codeowners-validator@v0.5.0
22+
if: github.event.pull_request.head.repo.full_name != github.repository
23+
name: "Syntax check of CODEOWNERS"
24+
with:
25+
checks: "syntax,duppatterns"

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,25 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are
6767

6868

6969

70+
## Security & Compliance [<img src="https://cloudposse.com/wp-content/uploads/2020/11/bridgecrew.svg" width="250" align="right" />](https://bridgecrew.io/)
71+
72+
Security scanning is graciously provided by Bridgecrew. Bridgecrew is the leading fully hosted, cloud-native solution providing continuous Terraform security and compliance.
73+
74+
| Benchmark | Description |
75+
|--------|---------------|
76+
| [![Infrastructure Security](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=INFRASTRUCTURE+SECURITY) | Infrastructure Security Compliance |
77+
| [![CIS KUBERNETES](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/cis_kubernetes)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=CIS+KUBERNETES+V1.5) | Center for Internet Security, KUBERNETES Compliance |
78+
| [![CIS AWS](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/cis_aws)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=CIS+AWS+V1.2) | Center for Internet Security, AWS Compliance |
79+
| [![CIS AZURE](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/cis_azure)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=CIS+AZURE+V1.1) | Center for Internet Security, AZURE Compliance |
80+
| [![PCI-DSS](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/pci)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=PCI-DSS+V3.2) | Payment Card Industry Data Security Standards Compliance |
81+
| [![NIST-800-53](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/nist)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=NIST-800-53) | National Institute of Standards and Technology Compliance |
82+
| [![ISO27001](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/iso)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=ISO27001) | Information Security Management System, ISO/IEC 27001 Compliance |
83+
| [![SOC2](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/soc2)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=SOC2)| Service Organization Control 2 Compliance |
84+
| [![CIS GCP](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/cis_gcp)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=CIS+GCP+V1.1) | Center for Internet Security, GCP Compliance |
85+
| [![HIPAA](https://www.bridgecrew.cloud/badges/github/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/hipaa)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=cloudposse%2Fterraform-aws-lambda-elasticsearch-cleanup&benchmark=HIPAA) | Health Insurance Portability and Accountability Compliance |
86+
87+
88+
7089
## Usage
7190

7291

@@ -140,8 +159,6 @@ by starting with `^`).
140159
```text
141160
Available targets:
142161
143-
build Build Lambda function zip
144-
dependencies Install dependencies
145162
help Help screen
146163
help/all Display help for all targets
147164
help/short This help short screen
@@ -161,7 +178,7 @@ is given
161178

162179
| Name | Version |
163180
|------|---------|
164-
| terraform | >= 0.12.26 |
181+
| terraform | >= 0.13.0 |
165182
| aws | >= 2.0 |
166183
| null | >= 2.0 |
167184

@@ -179,18 +196,20 @@ is given
179196
| artifact\_git\_ref | Git ref of the lambda artifact to use. Use latest version if null. | `string` | `""` | no |
180197
| artifact\_url | URL template for the remote artifact | `string` | `"https://artifacts.cloudposse.com/$${module_name}/$${git_ref}/$${filename}"` | no |
181198
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
182-
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
199+
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
183200
| delete\_after | Number of days to preserve | `number` | `15` | no |
184201
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
185202
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
186203
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
187204
| es\_domain\_arn | The Elasticsearch domain ARN | `string` | n/a | yes |
188205
| es\_endpoint | The Elasticsearch endpoint for the Lambda function to connect to | `string` | n/a | yes |
189206
| es\_security\_group\_id | The Elasticsearch cluster security group ID | `string` | n/a | yes |
190-
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
207+
| id\_length\_limit | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
191208
| index\_format | Combined with 'index' variable and is used to evaluate the index age | `string` | `"%Y.%m.%d"` | no |
192209
| index\_re | Regular Expression that matches the index names to clean up (not including trailing dash and date) | `string` | `".*"` | no |
210+
| label\_key\_case | The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
193211
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
212+
| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Default value: `lower`. | `string` | `null` | no |
194213
| name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
195214
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
196215
| python\_version | The Python version to use | `string` | `"3.7"` | no |

context.tf

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
module "this" {
2222
source = "cloudposse/label/null"
23-
version = "0.22.1" // requires Terraform >= 0.12.26
23+
version = "0.24.1" # requires Terraform >= 0.13.0
2424

2525
enabled = var.enabled
2626
namespace = var.namespace
@@ -34,27 +34,16 @@ module "this" {
3434
label_order = var.label_order
3535
regex_replace_chars = var.regex_replace_chars
3636
id_length_limit = var.id_length_limit
37+
label_key_case = var.label_key_case
38+
label_value_case = var.label_value_case
3739

3840
context = var.context
3941
}
4042

4143
# Copy contents of cloudposse/terraform-null-label/variables.tf here
4244

4345
variable "context" {
44-
type = object({
45-
enabled = bool
46-
namespace = string
47-
environment = string
48-
stage = string
49-
name = string
50-
delimiter = string
51-
attributes = list(string)
52-
tags = map(string)
53-
additional_tag_map = map(string)
54-
regex_replace_chars = string
55-
label_order = list(string)
56-
id_length_limit = number
57-
})
46+
type = any
5847
default = {
5948
enabled = true
6049
namespace = null
@@ -68,6 +57,8 @@ variable "context" {
6857
regex_replace_chars = null
6958
label_order = []
7059
id_length_limit = null
60+
label_key_case = null
61+
label_value_case = null
7162
}
7263
description = <<-EOT
7364
Single object for setting entire context at once.
@@ -76,6 +67,16 @@ variable "context" {
7667
Individual variable settings (non-null) override settings in context object,
7768
except for attributes, tags, and additional_tag_map, which are merged.
7869
EOT
70+
71+
validation {
72+
condition = lookup(var.context, "label_key_case", null) == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
73+
error_message = "Allowed values: `lower`, `title`, `upper`."
74+
}
75+
76+
validation {
77+
condition = lookup(var.context, "label_value_case", null) == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
78+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
79+
}
7980
}
8081

8182
variable "enabled" {
@@ -158,11 +159,44 @@ variable "id_length_limit" {
158159
type = number
159160
default = null
160161
description = <<-EOT
161-
Limit `id` to this many characters.
162+
Limit `id` to this many characters (minimum 6).
162163
Set to `0` for unlimited length.
163164
Set to `null` for default, which is `0`.
164165
Does not affect `id_full`.
165166
EOT
167+
validation {
168+
condition = var.id_length_limit == null ? true : var.id_length_limit >= 6 || var.id_length_limit == 0
169+
error_message = "The id_length_limit must be >= 6 if supplied (not null), or 0 for unlimited length."
170+
}
171+
}
172+
173+
variable "label_key_case" {
174+
type = string
175+
default = null
176+
description = <<-EOT
177+
The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
178+
Possible values: `lower`, `title`, `upper`.
179+
Default value: `title`.
180+
EOT
181+
182+
validation {
183+
condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
184+
error_message = "Allowed values: `lower`, `title`, `upper`."
185+
}
166186
}
167187

188+
variable "label_value_case" {
189+
type = string
190+
default = null
191+
description = <<-EOT
192+
The letter case of output label values (also used in `tags` and `id`).
193+
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
194+
Default value: `lower`.
195+
EOT
196+
197+
validation {
198+
condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
199+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
200+
}
201+
}
168202
#### End of copy of cloudposse/terraform-null-label/variables.tf

docs/targets.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
```text
44
Available targets:
55
6-
build Build Lambda function zip
7-
dependencies Install dependencies
86
help Help screen
97
help/all Display help for all targets
108
help/short This help short screen

0 commit comments

Comments
 (0)