Skip to content

Commit 7260781

Browse files
authored
Update README and framework (#16)
1 parent 772552f commit 7260781

File tree

8 files changed

+517
-420
lines changed

8 files changed

+517
-420
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SHELL := /bin/bash
33
# List of targets the `readme` target should call before generating the readme
44
export README_DEPS ?= docs/targets.md docs/terraform.md
55

6-
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
6+
-include $(shell curl -sSL -o .build-harness "https://cloudposse.tools/build-harness"; echo .build-harness)
77

88
## Lint terraform code
99
lint:

README.md

+33-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
2929
-->
3030

31-
This `terraform-aws-utils` project provides some simple utilities to use when working in AWS.
31+
This `terraform-aws-utils` module provides some simple utilities to use when working in AWS.
3232

3333
---
3434

@@ -61,23 +61,43 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are
6161

6262
## Introduction
6363

64-
This `terraform-aws-utils` project provides some simple utilities to use when working in AWS. At the moment, it is
65-
limited to providing compact alternative codes for Regions, Availability Zones, and Local Zones that are
66-
guaranteed to use only digits and lower case letters: no hyphens. Conversions to and from official codes
67-
and alternative codes are handled via lookup maps.
64+
This `terraform-aws-utils` module provides some simple utilities to use when working in AWS.
65+
More complex utilities are available through Cloud Posse's `utils` Terraform provider
66+
[terraform-provider-utils](https://github.com/cloudposse/terraform-provider-utils).
6867

69-
The `short` abbreviations are variable length (generally 4-6 characters, but length limits not guaranteed)
70-
and strictly algorithmically derived so that people can more easily interpret them.
71-
The `fixed` abbreviations are always exactly 3 characters for regions and 4 characters
68+
### Compact Alternative Codes (Abbreviations)
69+
This module's primary function is to provide compact alternative codes for Regions, Availability Zones,
70+
and Local Zones, codes which are guaranteed to use only digits and lower case letters: no hyphens.
71+
Conversions to and from official codes and alternative codes are handled via lookup maps.
72+
73+
- The `short` abbreviations are variable length (generally 4-6 characters, but length limits not guaranteed)
74+
and strictly algorithmically derived so that people can more easily interpret them. The `short` region
75+
code abbreviations typically match the prefix of the Availability Zone IDs in that region, but this is
76+
not guaranteed.
77+
- The `fixed` abbreviations are always exactly 3 characters for regions and 4 characters
7278
for availability zones and local zones, but have some exceptional cases (China, Africa, Asia-Pacific South, US GovCloud)
7379
that have non-obvious abbreviations.
80+
- The `identity` "abbreviations" are not abbreviations but are instead the official codes (output equals input,
81+
which is why it is called "identity"). This map is provided to simplify algorithmic choice of region code
82+
abbreviation when you want to include a "no abbreviation" option.
7483

7584
We currently support Local Zones but not Wavelength Zones. If we support Wavelength Zones in the future,
7685
it is likely that the fixed-length abbreviations for them will be non-intuitive.
7786

7887
The intention is that existing mappings will never change, and if new regions or zones are created that
7988
conflict with existing ones, they will be given non-standard mappings so as not to conflict.
8089

90+
### ELB Logging Account IDs
91+
92+
This module provides Elastic Load Balancing Account IDs per region to be used in
93+
configuring [S3 Bucket Permissions](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-logging-bucket-permissions)
94+
to allow access logs to be stored in S3.
95+
96+
### Enabled and Disabled Regions
97+
98+
For convenience, this module provides lists of enabled and disabled regions in the current account. Note that
99+
since these lists are dynamic, they cannot be used in Terraform `count` or `for_each` resource expressions.
100+
81101

82102
## Security & Compliance [<img src="https://cloudposse.com/wp-content/uploads/2020/11/bridgecrew.svg" width="250" align="right" />](https://bridgecrew.io/)
83103

@@ -236,6 +256,7 @@ Are you using this project or any of our other projects? Consider [leaving a tes
236256

237257
Check out these related projects.
238258

259+
- [terraform-provider-utils](https://github.com/cloudposse/terraform-provider-utils) - The Cloud Posse Terraform Provider for various utilities (e.g. deep merging, stack configuration management).
239260
- [terraform-null-label](https://github.com/cloudposse/terraform-null-label) - Terraform module designed to generate consistent names and tags for resources. Use terraform-null-label to implement a strict naming convention.
240261

241262

@@ -381,12 +402,14 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
381402
### Contributors
382403

383404
<!-- markdownlint-disable -->
384-
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] |
385-
|---|
405+
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Nuru][Nuru_avatar]][Nuru_homepage]<br/>[Nuru][Nuru_homepage] |
406+
|---|---|
386407
<!-- markdownlint-restore -->
387408

388409
[osterman_homepage]: https://github.com/osterman
389410
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png
411+
[Nuru_homepage]: https://github.com/Nuru
412+
[Nuru_avatar]: https://img.cloudposse.com/150x150/https://github.com/Nuru.png
390413

391414
[![README Footer][readme_footer_img]][readme_footer_link]
392415
[![Beacon][beacon]][website]

README.yaml

+34-9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ badges:
3636

3737
# List any related terraform modules that this module may be used with or that this module depends on.
3838
related:
39+
- name: "terraform-provider-utils"
40+
description: "The Cloud Posse Terraform Provider for various utilities (e.g. deep merging, stack configuration management)."
41+
url: "https://github.com/cloudposse/terraform-provider-utils"
3942
- name: "terraform-null-label"
4043
description: "Terraform module designed to generate consistent names and tags for resources. Use terraform-null-label to implement a strict naming convention."
4144
url: "https://github.com/cloudposse/terraform-null-label"
@@ -56,27 +59,47 @@ references:
5659
url: "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html"
5760
# Short description of this project
5861
description: |-
59-
This `terraform-aws-utils` project provides some simple utilities to use when working in AWS.
62+
This `terraform-aws-utils` module provides some simple utilities to use when working in AWS.
6063
6164
# Introduction to the project
6265
introduction: |-
63-
This `terraform-aws-utils` project provides some simple utilities to use when working in AWS. At the moment, it is
64-
limited to providing compact alternative codes for Regions, Availability Zones, and Local Zones that are
65-
guaranteed to use only digits and lower case letters: no hyphens. Conversions to and from official codes
66-
and alternative codes are handled via lookup maps.
67-
68-
The `short` abbreviations are variable length (generally 4-6 characters, but length limits not guaranteed)
69-
and strictly algorithmically derived so that people can more easily interpret them.
70-
The `fixed` abbreviations are always exactly 3 characters for regions and 4 characters
66+
This `terraform-aws-utils` module provides some simple utilities to use when working in AWS.
67+
More complex utilities are available through Cloud Posse's `utils` Terraform provider
68+
[terraform-provider-utils](https://github.com/cloudposse/terraform-provider-utils).
69+
70+
### Compact Alternative Codes (Abbreviations)
71+
This module's primary function is to provide compact alternative codes for Regions, Availability Zones,
72+
and Local Zones, codes which are guaranteed to use only digits and lower case letters: no hyphens.
73+
Conversions to and from official codes and alternative codes are handled via lookup maps.
74+
75+
- The `short` abbreviations are variable length (generally 4-6 characters, but length limits not guaranteed)
76+
and strictly algorithmically derived so that people can more easily interpret them. The `short` region
77+
code abbreviations typically match the prefix of the Availability Zone IDs in that region, but this is
78+
not guaranteed.
79+
- The `fixed` abbreviations are always exactly 3 characters for regions and 4 characters
7180
for availability zones and local zones, but have some exceptional cases (China, Africa, Asia-Pacific South, US GovCloud)
7281
that have non-obvious abbreviations.
82+
- The `identity` "abbreviations" are not abbreviations but are instead the official codes (output equals input,
83+
which is why it is called "identity"). This map is provided to simplify algorithmic choice of region code
84+
abbreviation when you want to include a "no abbreviation" option.
7385
7486
We currently support Local Zones but not Wavelength Zones. If we support Wavelength Zones in the future,
7587
it is likely that the fixed-length abbreviations for them will be non-intuitive.
7688
7789
The intention is that existing mappings will never change, and if new regions or zones are created that
7890
conflict with existing ones, they will be given non-standard mappings so as not to conflict.
7991
92+
### ELB Logging Account IDs
93+
94+
This module provides Elastic Load Balancing Account IDs per region to be used in
95+
configuring [S3 Bucket Permissions](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-logging-bucket-permissions)
96+
to allow access logs to be stored in S3.
97+
98+
### Enabled and Disabled Regions
99+
100+
For convenience, this module provides lists of enabled and disabled regions in the current account. Note that
101+
since these lists are dynamic, they cannot be used in Terraform `count` or `for_each` resource expressions.
102+
80103
# How to use this module. Should be an easy example to copy and paste.
81104
usage: |-
82105
Here's how to invoke this example module in your projects
@@ -123,3 +146,5 @@ include:
123146
contributors:
124147
- name: "Erik Osterman"
125148
github: "osterman"
149+
- name: "Nuru"
150+
github: "Nuru"

examples/complete/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
provider "aws" {
2+
region = var.region
3+
}
4+
15
module "example" {
26
source = "../.."
37

test/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ clean:
3333
all: module examples/complete
3434

3535
## Run basic sanity checks against the module itself
36-
module: export TESTS ?= installed lint get-modules module-pinning get-plugins provider-pinning validate terraform-docs input-descriptions output-descriptions
36+
module: export TESTS ?= installed lint module-pinning provider-pinning validate terraform-docs input-descriptions output-descriptions
3737
module: deps
3838
$(call RUN_TESTS, ../)
3939

4040
## Run tests against example
41-
examples/complete: export TESTS ?= installed lint get-modules get-plugins validate
41+
examples/complete: export TESTS ?= installed lint validate
4242
examples/complete: deps
4343
$(call RUN_TESTS, ../$@)

test/src/Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export TF_CLI_ARGS_init ?= -get-plugins=true
2-
export TERRAFORM_VERSION ?= $(shell curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version' | cut -d. -f1-2)
1+
export TERRAFORM_VERSION ?= $(shell curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version' | cut -d. -f1)
32

43
.DEFAULT_GOAL : all
54
.PHONY: all
@@ -16,7 +15,7 @@ init:
1615
## Run tests
1716
test: init
1817
go mod download
19-
go test -v -timeout 60m -run TestExamplesComplete
18+
go test -v -timeout 5m
2019

2120
## Run tests in docker container
2221
docker/test:

test/src/go.mod

+54-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,59 @@
11
module github.com/cloudposse/terraform-aws-utils
22

3-
go 1.14
3+
go 1.17
44

55
require (
6-
github.com/gruntwork-io/terratest v0.31.1
7-
github.com/stretchr/testify v1.6.1
8-
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
9-
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
10-
golang.org/x/sys v0.0.0-20200828194041-157a740278f4 // indirect
11-
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
6+
github.com/gruntwork-io/terratest v0.39.0
7+
github.com/stretchr/testify v1.7.0
8+
)
9+
10+
require (
11+
cloud.google.com/go v0.83.0 // indirect
12+
cloud.google.com/go/storage v1.10.0 // indirect
13+
github.com/agext/levenshtein v1.2.3 // indirect
14+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
15+
github.com/aws/aws-sdk-go v1.40.56 // indirect
16+
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
17+
github.com/davecgh/go-spew v1.1.1 // indirect
18+
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
19+
github.com/golang/protobuf v1.5.2 // indirect
20+
github.com/golang/snappy v0.0.3 // indirect
21+
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
22+
github.com/hashicorp/errwrap v1.0.0 // indirect
23+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
24+
github.com/hashicorp/go-getter v1.5.11 // indirect
25+
github.com/hashicorp/go-multierror v1.1.0 // indirect
26+
github.com/hashicorp/go-safetemp v1.0.0 // indirect
27+
github.com/hashicorp/go-version v1.3.0 // indirect
28+
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
29+
github.com/hashicorp/terraform-json v0.13.0 // indirect
30+
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
31+
github.com/jmespath/go-jmespath v0.4.0 // indirect
32+
github.com/jstemmer/go-junit-report v0.9.1 // indirect
33+
github.com/klauspost/compress v1.13.0 // indirect
34+
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
35+
github.com/mitchellh/go-homedir v1.1.0 // indirect
36+
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
37+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
38+
github.com/pmezard/go-difflib v1.0.0 // indirect
39+
github.com/tmccombs/hcl2json v0.3.3 // indirect
40+
github.com/ulikunitz/xz v0.5.8 // indirect
41+
github.com/zclconf/go-cty v1.9.1 // indirect
42+
go.opencensus.io v0.23.0 // indirect
43+
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
44+
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
45+
golang.org/x/mod v0.4.2 // indirect
46+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
47+
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
48+
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect
49+
golang.org/x/text v0.3.6 // indirect
50+
golang.org/x/tools v0.1.2 // indirect
51+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
52+
google.golang.org/api v0.47.0 // indirect
53+
google.golang.org/appengine v1.6.7 // indirect
54+
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
55+
google.golang.org/grpc v1.38.0 // indirect
56+
google.golang.org/protobuf v1.26.0 // indirect
57+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
58+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
1259
)

0 commit comments

Comments
 (0)