Skip to content

Commit e1bcece

Browse files
authored
minimum required Terraform version bumped to 0.13.0, context.tf updated, readme updated (#97)
1 parent 7f64e0d commit e1bcece

File tree

12 files changed

+240
-22
lines changed

12 files changed

+240
-22
lines changed

.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/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/[email protected]
3939
with:
4040
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
41+
committer: 'cloudpossebot <[email protected]>'
42+
author: 'cloudpossebot <[email protected]>'
4143
commit-message: Update context.tf from origin source
4244
title: Update context.tf
4345
body: |-

.github/workflows/auto-format.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Auto Format
2+
on:
3+
pull_request_target:
4+
types: [opened, synchronize]
5+
6+
jobs:
7+
auto-format:
8+
runs-on: ubuntu-latest
9+
container: cloudposse/build-harness:slim-latest
10+
steps:
11+
# Checkout the pull request branch
12+
# "An action in a workflow run can’t trigger a new workflow run. For example, if an action pushes code using
13+
# the repository’s GITHUB_TOKEN, a new workflow will not run even when the repository contains
14+
# a workflow configured to run when push events occur."
15+
# However, using a personal access token will cause events to be triggered.
16+
# We need that to ensure a status gets posted after the auto-format commit.
17+
# We also want to trigger tests if the auto-format made no changes.
18+
- uses: actions/checkout@v2
19+
if: github.event.pull_request.state == 'open'
20+
name: Privileged Checkout
21+
with:
22+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
23+
repository: ${{ github.event.pull_request.head.repo.full_name }}
24+
# Check out the PR commit, not the merge commit
25+
# Use `ref` instead of `sha` to enable pushing back to `ref`
26+
ref: ${{ github.event.pull_request.head.ref }}
27+
28+
# Do all the formatting stuff
29+
- name: Auto Format
30+
if: github.event.pull_request.state == 'open'
31+
shell: bash
32+
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host
33+
34+
# Commit changes (if any) to the PR branch
35+
- name: Commit changes to the PR branch
36+
if: github.event.pull_request.state == 'open'
37+
shell: bash
38+
id: commit
39+
env:
40+
SENDER: ${{ github.event.sender.login }}
41+
run: |
42+
set -x
43+
output=$(git diff --name-only)
44+
45+
if [ -n "$output" ]; then
46+
echo "Changes detected. Pushing to the PR branch"
47+
git config --global user.name 'cloudpossebot'
48+
git config --global user.email '[email protected]'
49+
git add -A
50+
git commit -m "Auto Format"
51+
# Prevent looping by not pushing changes in response to changes from cloudpossebot
52+
[[ $SENDER == "cloudpossebot" ]] || git push
53+
# Set status to fail, because the push should trigger another status check,
54+
# and we use success to indicate the checks are finished.
55+
printf "::set-output name=%s::%s\n" "changed" "true"
56+
exit 1
57+
else
58+
printf "::set-output name=%s::%s\n" "changed" "false"
59+
echo "No changes detected"
60+
fi
61+
62+
- name: Auto Test
63+
uses: cloudposse/actions/github/[email protected]
64+
# match users by ID because logins (user names) are inconsistent,
65+
# for example in the REST API Renovate Bot is `renovate[bot]` but
66+
# in GraphQL it is just `renovate`, plus there is a non-bot
67+
# user `renovate` with ID 1832810.
68+
# Mergify bot: 37929162
69+
# Renovate bot: 29139614
70+
# Cloudpossebot: 11232728
71+
# Need to use space separators to prevent "21" from matching "112144"
72+
if: >
73+
contains(' 37929162 29139614 11232728 ', format(' {0} ', github.event.pull_request.user.id))
74+
&& steps.commit.outputs.changed == 'false' && github.event.pull_request.state == 'open'
75+
with:
76+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
77+
repository: cloudposse/actions
78+
event-type: test-command
79+
client-payload: |-
80+
{ "slash_command":{"args": {"unnamed": {"all": "all", "arg1": "all"}}},
81+
"pull_request": ${{ toJSON(github.event.pull_request) }},
82+
"github":{"payload":{"repository": ${{ toJSON(github.event.repository) }},
83+
"comment": {"id": ""}
84+
}
85+
}
86+
}

.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/[email protected]
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/[email protected]
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: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@ If you enable zone awareness for your domain, Amazon ES places an endpoint into
7474
The subnets must be in different Availability Zones in the same region.
7575
If you don't enable zone awareness, Amazon ES places an endpoint into only one subnet. You also need to set `availability_zone_count` to `1`.
7676

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

7998

@@ -147,7 +166,7 @@ Available targets:
147166

148167
| Name | Version |
149168
|------|---------|
150-
| terraform | >= 0.12.26 |
169+
| terraform | >= 0.13.0 |
151170
| aws | >= 2.0 |
152171
| null | >= 2.0 |
153172
| template | >= 2.0 |
@@ -178,7 +197,7 @@ Available targets:
178197
| cognito\_iam\_role\_arn | ARN of the IAM role that has the AmazonESCognitoAccess policy attached | `string` | `""` | no |
179198
| cognito\_identity\_pool\_id | The ID of the Cognito Identity Pool to use | `string` | `""` | no |
180199
| cognito\_user\_pool\_id | The ID of the Cognito User Pool to use | `string` | `""` | no |
181-
| 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 |
200+
| 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> label_key_case = string<br> label_value_case = string<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_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 |
182201
| create\_iam\_service\_linked\_role | Whether to create `AWSServiceRoleForAmazonElasticsearchService` service-linked role. Set it to `false` if you already have an ElasticSearch cluster created in the AWS account and AWSServiceRoleForAmazonElasticsearchService already exists. See https://github.com/terraform-providers/terraform-provider-aws/issues/5218 for more info | `bool` | `true` | no |
183202
| dedicated\_master\_count | Number of dedicated master nodes in the cluster | `number` | `0` | no |
184203
| dedicated\_master\_enabled | Indicates whether dedicated master nodes are enabled for the cluster | `bool` | `false` | no |
@@ -208,7 +227,9 @@ Available targets:
208227
| instance\_type | Elasticsearch instance type for data nodes in the cluster | `string` | `"t2.small.elasticsearch"` | no |
209228
| kibana\_hostname\_enabled | Explicit flag to enable creating a DNS hostname for Kibana. If `true`, then `var.dns_zone_id` is required. | `bool` | `false` | no |
210229
| kibana\_subdomain\_name | The name of the subdomain for Kibana in the DNS zone (\_e.g.\_ `kibana`, `ui`, `ui-es`, `search-ui`, `kibana.elasticsearch`) | `string` | n/a | yes |
230+
| 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 |
211231
| 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 |
232+
| 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 |
212233
| log\_publishing\_application\_cloudwatch\_log\_group\_arn | ARN of the CloudWatch log group to which log for ES\_APPLICATION\_LOGS needs to be published | `string` | `""` | no |
213234
| log\_publishing\_application\_enabled | Specifies whether log publishing option for ES\_APPLICATION\_LOGS is enabled or not | `bool` | `false` | no |
214235
| log\_publishing\_audit\_cloudwatch\_log\_group\_arn | ARN of the CloudWatch log group to which log for AUDIT\_LOGS needs to be published | `string` | `""` | no |

context.tf

Lines changed: 44 additions & 1 deletion
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.23.0" // requires Terraform >= 0.13.0
2424

2525
enabled = var.enabled
2626
namespace = var.namespace
@@ -54,6 +54,8 @@ variable "context" {
5454
regex_replace_chars = string
5555
label_order = list(string)
5656
id_length_limit = number
57+
label_key_case = string
58+
label_value_case = string
5759
})
5860
default = {
5961
enabled = true
@@ -68,6 +70,8 @@ variable "context" {
6870
regex_replace_chars = null
6971
label_order = []
7072
id_length_limit = null
73+
label_key_case = null
74+
label_value_case = null
7175
}
7276
description = <<-EOT
7377
Single object for setting entire context at once.
@@ -76,6 +80,16 @@ variable "context" {
7680
Individual variable settings (non-null) override settings in context object,
7781
except for attributes, tags, and additional_tag_map, which are merged.
7882
EOT
83+
84+
validation {
85+
condition = var.context["label_key_case"] == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
86+
error_message = "Allowed values: `lower`, `title`, `upper`."
87+
}
88+
89+
validation {
90+
condition = var.context["label_value_case"] == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
91+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
92+
}
7993
}
8094

8195
variable "enabled" {
@@ -165,4 +179,33 @@ variable "id_length_limit" {
165179
EOT
166180
}
167181

182+
variable "label_key_case" {
183+
type = string
184+
default = null
185+
description = <<-EOT
186+
The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
187+
Possible values: `lower`, `title`, `upper`.
188+
Default value: `title`.
189+
EOT
190+
191+
validation {
192+
condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
193+
error_message = "Allowed values: `lower`, `title`, `upper`."
194+
}
195+
}
196+
197+
variable "label_value_case" {
198+
type = string
199+
default = null
200+
description = <<-EOT
201+
The letter case of output label values (also used in `tags` and `id`).
202+
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
203+
Default value: `lower`.
204+
EOT
205+
206+
validation {
207+
condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
208+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
209+
}
210+
}
168211
#### End of copy of cloudposse/terraform-null-label/variables.tf

0 commit comments

Comments
 (0)