Skip to content

Commit 698bb1e

Browse files
authored
Update context provider versions (#52)
1 parent 5a4abb7 commit 698bb1e

File tree

13 files changed

+459
-247
lines changed

13 files changed

+459
-247
lines changed

.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212

1313
# Cloud Posse must review any changes to GitHub actions
1414
.github/* @cloudposse/engineering
15+
16+
# Cloud Posse must review any changes to standard context definition
17+
**/context.tf @cloudposse/engineering

.github/workflows/auto-release.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ name: auto-release
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77

88
jobs:
99
semver:
1010
runs-on: ubuntu-latest
1111
steps:
12-
# Drafts your next Release notes as Pull Requests are merged into "master"
13-
- uses: release-drafter/release-drafter@v5
14-
with:
15-
publish: true
16-
prerelease: false
17-
config-name: auto-release.yml
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
# Drafts your next Release notes as Pull Requests are merged into "master"
13+
- uses: release-drafter/release-drafter@v5
14+
with:
15+
publish: true
16+
prerelease: false
17+
config-name: auto-release.yml
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}

README.md

+24-17
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,25 @@ Available targets:
177177
| Name | Version |
178178
|------|---------|
179179
| terraform | >= 0.12.0 |
180-
| aws | ~> 2.0 |
181-
| local | ~> 1.2 |
182-
| null | ~> 2.0 |
183-
| random | ~> 2.1 |
184-
| template | ~> 2.0 |
180+
| aws | >= 2.0 |
181+
| local | >= 1.2 |
182+
| null | >= 2.0 |
183+
| random | >= 2.1 |
184+
| template | >= 2.0 |
185185
186186
## Providers
187187
188188
| Name | Version |
189189
|------|---------|
190-
| aws | ~> 2.0 |
191-
| random | ~> 2.1 |
190+
| aws | >= 2.0 |
191+
| random | >= 2.1 |
192192
193193
## Inputs
194194
195195
| Name | Description | Type | Default | Required |
196196
|------|-------------|------|---------|:--------:|
197-
| attributes | Additional attributes (\_e.g.\_ "1") | `list(string)` | `[]` | no |
197+
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
198+
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
198199
| aws\_account\_id | AWS Account ID. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | `string` | `""` | no |
199200
| badge\_enabled | Generates a publicly-accessible URL for the projects build badge. Available as badge\_url attribute when enabled | `bool` | `false` | no |
200201
| branch | Branch of the GitHub repository, _e.g._ `master` | `string` | n/a | yes |
@@ -204,29 +205,33 @@ Available targets:
204205
| buildspec | Declaration to use for building the project. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html) | `string` | `""` | no |
205206
| cache\_type | The type of storage that will be used for the AWS CodeBuild project cache. Valid values: NO\_CACHE, LOCAL, and S3. Defaults to S3. If cache\_type is S3, it will create an S3 bucket for storing codebuild cache inside | `string` | `"S3"` | no |
206207
| codestar\_connection\_arn | CodeStar connection ARN required for Bitbucket integration with CodePipeline | `string` | `""` | no |
207-
| delimiter | Delimiter between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
208+
| 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 |
209+
| 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 |
208210
| ecs\_cluster\_name | ECS Cluster Name | `string` | n/a | yes |
209-
| enabled | Enable `CodePipeline` creation | `bool` | `true` | no |
210-
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | `string` | `""` | no |
211+
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
212+
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
211213
| environment\_variables | A list of maps, that contain both the key 'name' and the key 'value' to be used as additional environment variables for the build | <pre>list(object(<br> {<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
212214
| github\_anonymous | Github Anonymous API (if `true`, token must not be set as GITHUB\_TOKEN or `github_token`) | `bool` | `false` | no |
213215
| github\_oauth\_token | GitHub OAuth Token with permissions to access private repositories | `string` | `""` | no |
214216
| github\_webhook\_events | A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/) | `list(string)` | <pre>[<br> "push"<br>]</pre> | no |
215217
| github\_webhooks\_token | GitHub OAuth Token with permissions to create webhooks. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable | `string` | `""` | no |
218+
| 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 |
216219
| image\_repo\_name | ECR repository name to store the Docker image built by this module. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | `string` | n/a | yes |
217220
| image\_tag | Docker image tag in the ECR repository, e.g. 'latest'. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | `string` | `"latest"` | no |
221+
| 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 |
218222
| local\_cache\_modes | Specifies settings that AWS CodeBuild uses to store and reuse build dependencies. Valid values: LOCAL\_SOURCE\_CACHE, LOCAL\_DOCKER\_LAYER\_CACHE, and LOCAL\_CUSTOM\_CACHE | `list(string)` | `[]` | no |
219-
| name | Name of the application | `string` | n/a | yes |
220-
| namespace | Namespace (e.g. `eg` or `cp`) | `string` | `""` | no |
223+
| name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
224+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
221225
| poll\_source\_changes | Periodically check the location of your source content and run the pipeline if changes are detected | `bool` | `false` | no |
222226
| privileged\_mode | If set to true, enables running the Docker daemon inside a Docker container on the CodeBuild instance. Used when building Docker images | `bool` | `false` | no |
227+
| regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
223228
| region | AWS Region, e.g. us-east-1. Used as CodeBuild ENV variable when building Docker images. [For more info](http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html) | `string` | n/a | yes |
224229
| repo\_name | GitHub repository name of the application to be built and deployed to ECS | `string` | n/a | yes |
225230
| repo\_owner | GitHub Organization or Username | `string` | n/a | yes |
226231
| s3\_bucket\_force\_destroy | A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error | `bool` | `false` | no |
227232
| service\_name | ECS Service Name | `string` | n/a | yes |
228-
| stage | Stage (e.g. `prod`, `dev`, `staging`) | `string` | `""` | no |
229-
| tags | Additional tags (\_e.g.\_ { BusinessUnit : ABC }) | `map(string)` | `{}` | no |
233+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
234+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
230235
| webhook\_authentication | The type of authentication to use. One of IP, GITHUB\_HMAC, or UNAUTHENTICATED | `string` | `"GITHUB_HMAC"` | no |
231236
| webhook\_enabled | Set to false to prevent the module from creating any webhook resources | `bool` | `true` | no |
232237
| webhook\_filter\_json\_path | The JSON path to filter on | `string` | `"$.ref"` | no |
@@ -411,8 +416,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
411416

412417
### Contributors
413418

414-
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Sarkis Varozian][sarkis_avatar]][sarkis_homepage]<br/>[Sarkis Varozian][sarkis_homepage] |
415-
|---|---|---|---|
419+
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Sarkis Varozian][sarkis_avatar]][sarkis_homepage]<br/>[Sarkis Varozian][sarkis_homepage] | [![Joe Niland][joe-niland_avatar]][joe-niland_homepage]<br/>[Joe Niland][joe-niland_homepage] |
420+
|---|---|---|---|---|
416421

417422
[osterman_homepage]: https://github.com/osterman
418423
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png
@@ -422,6 +427,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
422427
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png
423428
[sarkis_homepage]: https://github.com/sarkis
424429
[sarkis_avatar]: https://img.cloudposse.com/150x150/https://github.com/sarkis.png
430+
[joe-niland_homepage]: https://github.com/joe-niland
431+
[joe-niland_avatar]: https://img.cloudposse.com/150x150/https://github.com/joe-niland.png
425432

426433
[![README Footer][readme_footer_img]][readme_footer_link]
427434
[![Beacon][beacon]][website]

README.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,5 @@ contributors:
171171
github: "aknysh"
172172
- name: "Sarkis Varozian"
173173
github: "sarkis"
174+
- name: "Joe Niland"
175+
github: "joe-niland"

context.tf

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
#
2+
# ONLY EDIT THIS FILE IN github.com/cloudposse/terraform-null-label
3+
# All other instances of this file should be a copy of that one
4+
#
5+
#
6+
# Copy this file from https://github.com/cloudposse/terraform-null-label/blob/master/exports/context.tf
7+
# and then place it in your Terraform module to automatically get
8+
# Cloud Posse's standard configuration inputs suitable for passing
9+
# to Cloud Posse modules.
10+
#
11+
# Modules should access the whole context as `module.this.context`
12+
# to get the input variables with nulls for defaults,
13+
# for example `context = module.this.context`,
14+
# and access individual variables as `module.this.<var>`,
15+
# with final values filled in.
16+
#
17+
# For example, when using defaults, `module.this.context.delimiter`
18+
# will be null, and `module.this.delimiter` will be `-` (hyphen).
19+
#
20+
21+
module "this" {
22+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.21.0"
23+
24+
enabled = var.enabled
25+
namespace = var.namespace
26+
environment = var.environment
27+
stage = var.stage
28+
name = var.name
29+
delimiter = var.delimiter
30+
attributes = var.attributes
31+
tags = var.tags
32+
additional_tag_map = var.additional_tag_map
33+
label_order = var.label_order
34+
regex_replace_chars = var.regex_replace_chars
35+
id_length_limit = var.id_length_limit
36+
37+
context = var.context
38+
}
39+
40+
# Copy contents of cloudposse/terraform-null-label/variables.tf here
41+
42+
variable "context" {
43+
type = object({
44+
enabled = bool
45+
namespace = string
46+
environment = string
47+
stage = string
48+
name = string
49+
delimiter = string
50+
attributes = list(string)
51+
tags = map(string)
52+
additional_tag_map = map(string)
53+
regex_replace_chars = string
54+
label_order = list(string)
55+
id_length_limit = number
56+
})
57+
default = {
58+
enabled = true
59+
namespace = null
60+
environment = null
61+
stage = null
62+
name = null
63+
delimiter = null
64+
attributes = []
65+
tags = {}
66+
additional_tag_map = {}
67+
regex_replace_chars = null
68+
label_order = []
69+
id_length_limit = null
70+
}
71+
description = <<-EOT
72+
Single object for setting entire context at once.
73+
See description of individual variables for details.
74+
Leave string and numeric variables as `null` to use default value.
75+
Individual variable settings (non-null) override settings in context object,
76+
except for attributes, tags, and additional_tag_map, which are merged.
77+
EOT
78+
}
79+
80+
variable "enabled" {
81+
type = bool
82+
default = null
83+
description = "Set to false to prevent the module from creating any resources"
84+
}
85+
86+
variable "namespace" {
87+
type = string
88+
default = null
89+
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
90+
}
91+
92+
variable "environment" {
93+
type = string
94+
default = null
95+
description = "Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT'"
96+
}
97+
98+
variable "stage" {
99+
type = string
100+
default = null
101+
description = "Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release'"
102+
}
103+
104+
variable "name" {
105+
type = string
106+
default = null
107+
description = "Solution name, e.g. 'app' or 'jenkins'"
108+
}
109+
110+
variable "delimiter" {
111+
type = string
112+
default = null
113+
description = <<-EOT
114+
Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.
115+
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all.
116+
EOT
117+
}
118+
119+
variable "attributes" {
120+
type = list(string)
121+
default = []
122+
description = "Additional attributes (e.g. `1`)"
123+
}
124+
125+
variable "tags" {
126+
type = map(string)
127+
default = {}
128+
description = "Additional tags (e.g. `map('BusinessUnit','XYZ')`"
129+
}
130+
131+
variable "additional_tag_map" {
132+
type = map(string)
133+
default = {}
134+
description = "Additional tags for appending to tags_as_list_of_maps. Not added to `tags`."
135+
}
136+
137+
variable "label_order" {
138+
type = list(string)
139+
default = null
140+
description = <<-EOT
141+
The naming order of the id output and Name tag.
142+
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
143+
You can omit any of the 5 elements, but at least one must be present.
144+
EOT
145+
}
146+
147+
variable "regex_replace_chars" {
148+
type = string
149+
default = null
150+
description = <<-EOT
151+
Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.
152+
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits.
153+
EOT
154+
}
155+
156+
variable "id_length_limit" {
157+
type = number
158+
default = null
159+
description = <<-EOT
160+
Limit `id` to this many characters.
161+
Set to `0` for unlimited length.
162+
Set to `null` for default, which is `0`.
163+
Does not affect `id_full`.
164+
EOT
165+
}
166+
167+
#### End of copy of cloudposse/terraform-null-label/variables.tf

0 commit comments

Comments
 (0)