Skip to content

Commit ed6ab68

Browse files
authored
Update codefresh badge (#63)
* Convert to TF 0.12 * Convert to TF 0.12 * Convert to TF 0.12 * Update `label` modules to version `0.13.0` which supports TF `0.12` * Update Codefresh badge * Update Codefresh pipeline * Update README * Update README * Update README * Update README * Pin providers * Add region * test * test
1 parent 5cb8cfe commit ed6ab68

22 files changed

+379
-245
lines changed

.travis.yml

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

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[![Cloud Posse][logo]](https://cpco.io/homepage)
55

6-
# terraform-aws-dynamic-subnets [![Codefresh Build Status](https://g.codefresh.io/api/badges/pipeline/cloudposse/cloudposse%2Fterraform-aws-dynamic-subnets%2Ftest?type=cf-1)](https://g.codefresh.io/public/accounts/cloudposse/pipelines/cloudposse/terraform-aws-dynamic-subnets/test) [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-dynamic-subnets.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-dynamic-subnets) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-dynamic-subnets.svg)](https://github.com/cloudposse/terraform-aws-dynamic-subnets/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
6+
# terraform-aws-dynamic-subnets [![Codefresh Build Status](https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-dynamic-subnets?type=cf-1)](https://g.codefresh.io/public/accounts/cloudposse/pipelines/5d02dad8572be040f879f8ed) [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-dynamic-subnets.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-dynamic-subnets) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-dynamic-subnets.svg)](https://github.com/cloudposse/terraform-aws-dynamic-subnets/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
77

88

99
Terraform module to provision public and private [`subnets`](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) in an existing [`VPC`](https://aws.amazon.com/vpc)
@@ -56,7 +56,7 @@ module "subnets" {
5656
providers = {
5757
aws = "aws"
5858
}
59-
namespace = "cp"
59+
namespace = "eg"
6060
stage = "prod"
6161
name = "app"
6262
region = "us-east-1"
@@ -67,7 +67,7 @@ module "subnets" {
6767
}
6868
```
6969

70-
Learn about [using providers](https://www.terraform.io/docs/configuration-0-11/modules.html#providers-within-modules) with terraform modules.
70+
Learn about [using providers](https://www.terraform.io/docs/configuration-0-11/modules.html#providers-within-modules) with terraform modules.
7171

7272

7373

@@ -83,7 +83,7 @@ For subnet set calculation, the module uses Terraform interpolation
8383
[cidrsubnet](https://www.terraform.io/docs/configuration/interpolation.html#cidrsubnet-iprange-newbits-netnum-).
8484

8585

86-
```hcl
86+
```
8787
${
8888
cidrsubnet(
8989
signum(length(var.cidr_block)) == 1 ?
@@ -160,29 +160,29 @@ Available targets:
160160

161161
| Name | Description | Type | Default | Required |
162162
|------|-------------|:----:|:-----:|:-----:|
163-
| additional_tag_map | Additional tags for appending to each tag map | map | `<map>` | no |
164-
| attributes | Any extra attributes for naming these resources | list | `<list>` | no |
165-
| availability_zones | List of Availability Zones where subnets will be created | list | - | yes |
163+
| additional_tag_map | Additional tags for appending to each tag map | map(string) | `<map>` | no |
164+
| attributes | Any extra attributes for naming these resources | list(string) | `<list>` | no |
165+
| availability_zones | List of Availability Zones where subnets will be created | list(string) | - | yes |
166166
| cidr_block | Base CIDR block which will be divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | string | - | yes |
167-
| context | The context output from an external label module to pass to the label modules within this module | map | `<map>` | no |
167+
| context | Default context to use for passing state between label invocations | object | `<map>` | no |
168168
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no |
169169
| environment | The environment name if not using stage | string | `` | no |
170170
| igw_id | Internet Gateway ID the public route table will point to (e.g. `igw-9c26a123`) | string | - | yes |
171-
| label_order | The naming order of the id output and Name tag | list | `<list>` | no |
172-
| map_public_ip_on_launch | Instances launched into a public subnet should be assigned a public IP address | string | `true` | no |
173-
| max_subnet_count | Sets the maximum amount of subnets to deploy. 0 will deploy a subnet for every provided availablility zone (in `availability_zones` variable) within the region | string | `0` | no |
171+
| label_order | The naming order of the ID output and Name tag | list(string) | `<list>` | no |
172+
| map_public_ip_on_launch | Instances launched into a public subnet should be assigned a public IP address | bool | `true` | no |
173+
| max_subnet_count | Sets the maximum amount of subnets to deploy. 0 will deploy a subnet for every provided availablility zone (in `availability_zones` variable) within the region | string | `0` | no |
174174
| name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no |
175175
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
176-
| nat_gateway_enabled | Flag to enable/disable NAT Gateways to allow servers in the private subnets to access the Internet | string | `true` | no |
177-
| nat_instance_enabled | Flag to enable/disable NAT Instances to allow servers in the private subnets to access the Internet | string | `false` | no |
176+
| nat_gateway_enabled | Flag to enable/disable NAT Gateways to allow servers in the private subnets to access the Internet | bool | `true` | no |
177+
| nat_instance_enabled | Flag to enable/disable NAT Instances to allow servers in the private subnets to access the Internet | bool | `false` | no |
178178
| nat_instance_type | NAT Instance type | string | `t3.micro` | no |
179179
| private_network_acl_id | Network ACL ID that will be added to private subnets. If empty, a new ACL will be created | string | `` | no |
180180
| public_network_acl_id | Network ACL ID that will be added to public subnets. If empty, a new ACL will be created | string | `` | no |
181181
| regex_replace_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed | string | `/[^a-zA-Z0-9-]/` | no |
182182
| stage | Stage, e.g. 'prod', 'staging', 'dev', or 'test' | string | `` | no |
183183
| subnet_type_tag_key | Key for subnet type tag to provide information about the type of subnets, e.g. `cpco.io/subnet/type=private` or `cpco.io/subnet/type=public` | string | `cpco.io/subnet/type` | no |
184184
| subnet_type_tag_value_format | This is using the format interpolation symbols to allow the value of the subnet_type_tag_key to be modified. | string | `%s` | no |
185-
| tags | Additional tags to apply to all resources that use this label module | map | `<map>` | no |
185+
| tags | Additional tags to apply to all resources that use this label module | map(string) | `<map>` | no |
186186
| vpc_default_route_table_id | Default route table for public subnets. If not set, will be created. (e.g. `rtb-f4f0ce12`) | string | `` | no |
187187
| vpc_id | VPC ID where subnets will be created (e.g. `vpc-aceb2723`) | string | - | yes |
188188

README.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ license: "APACHE2"
3030
# Canonical GitHub repo
3131
github_repo: cloudposse/terraform-aws-dynamic-subnets
3232

33+
3334
# Badges to display
3435
badges:
3536
- name: "Codefresh Build Status"
36-
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/cloudposse%2Fterraform-aws-dynamic-subnets%2Ftest?type=cf-1"
37-
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/cloudposse/terraform-aws-dynamic-subnets/test"
37+
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-dynamic-subnets?type=cf-1"
38+
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/5d02dad8572be040f879f8ed"
3839
- name: "Build Status"
3940
image: "https://travis-ci.org/cloudposse/terraform-aws-dynamic-subnets.svg?branch=master"
4041
url: "https://travis-ci.org/cloudposse/terraform-aws-dynamic-subnets"
@@ -74,7 +75,7 @@ usage: |-
7475
providers = {
7576
aws = "aws"
7677
}
77-
namespace = "cp"
78+
namespace = "eg"
7879
stage = "prod"
7980
name = "app"
8081
region = "us-east-1"
@@ -85,7 +86,7 @@ usage: |-
8586
}
8687
```
8788
88-
Learn about [using providers](https://www.terraform.io/docs/configuration-0-11/modules.html#providers-within-modules) with terraform modules.
89+
Learn about [using providers](https://www.terraform.io/docs/configuration-0-11/modules.html#providers-within-modules) with terraform modules.
8990
9091
include:
9192
- "docs/design.md"

codefresh/test.yml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: '1.0'
22

33
stages:
4-
- Prepare
5-
- Test
4+
- Prepare
5+
- Test
66

77
steps:
88
wait:
@@ -30,12 +30,13 @@ steps:
3030
image: ${{TEST_IMAGE}}
3131
stage: Prepare
3232
commands:
33-
- cf_export PATH="/usr/local/terraform/0.11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
34-
- make init
35-
- git -C build-harness checkout master
36-
- make -C test/ clean init TEST_HARNESS_BRANCH=master
37-
- make -C test/src clean init
38-
- find test/src -name '*.tf' -delete
33+
- cf_export PATH="/usr/local/terraform/0.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
34+
- make init
35+
- git -C build-harness checkout master
36+
- make -C test/ clean init TEST_HARNESS_BRANCH=master
37+
- make -C test/src clean init
38+
- find . -type d -name '.terraform' | xargs rm -rf
39+
- find . -type f -name 'terraform.tfstate*' -exec rm -f {} \;
3940

4041
test:
4142
type: "parallel"
@@ -49,25 +50,25 @@ steps:
4950
image: ${{TEST_IMAGE}}
5051
description: Test "readme/lint"
5152
commands:
52-
- make readme/lint
53+
- make readme/lint
5354

5455
test_module:
5556
title: Test module with bats
5657
image: ${{TEST_IMAGE}}
5758
stage: Test
5859
commands:
59-
- make -C test/ module
60+
- make -C test/ module
6061

61-
test_examples_complete:
62-
title: Test "examples/complete" with bats
63-
image: ${{TEST_IMAGE}}
64-
stage: Test
65-
commands:
66-
- make -C test/ examples/complete
67-
68-
test_examples_complete_terratest:
69-
title: Test "examples/complete" with terratest
70-
image: ${{TEST_IMAGE}}
71-
stage: Test
72-
commands:
73-
- make -C test/src
62+
# test_examples_complete:
63+
# title: Test "examples/complete" with bats
64+
# image: ${{TEST_IMAGE}}
65+
# stage: Test
66+
# commands:
67+
# - make -C test/ examples/complete
68+
#
69+
# test_examples_complete_terratest:
70+
# title: Test "examples/complete" with terratest
71+
# image: ${{TEST_IMAGE}}
72+
# stage: Test
73+
# commands:
74+
# - make -C test/src

docs/design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ For subnet set calculation, the module uses Terraform interpolation
77
[cidrsubnet](https://www.terraform.io/docs/configuration/interpolation.html#cidrsubnet-iprange-newbits-netnum-).
88

99

10-
```hcl
10+
```
1111
${
1212
cidrsubnet(
1313
signum(length(var.cidr_block)) == 1 ?

docs/terraform.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
| Name | Description | Type | Default | Required |
44
|------|-------------|:----:|:-----:|:-----:|
5-
| additional_tag_map | Additional tags for appending to each tag map | map | `<map>` | no |
6-
| attributes | Any extra attributes for naming these resources | list | `<list>` | no |
7-
| availability_zones | List of Availability Zones where subnets will be created | list | - | yes |
5+
| additional_tag_map | Additional tags for appending to each tag map | map(string) | `<map>` | no |
6+
| attributes | Any extra attributes for naming these resources | list(string) | `<list>` | no |
7+
| availability_zones | List of Availability Zones where subnets will be created | list(string) | - | yes |
88
| cidr_block | Base CIDR block which will be divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | string | - | yes |
9-
| context | The context output from an external label module to pass to the label modules within this module | map | `<map>` | no |
9+
| context | Default context to use for passing state between label invocations | object | `<map>` | no |
1010
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no |
1111
| environment | The environment name if not using stage | string | `` | no |
1212
| igw_id | Internet Gateway ID the public route table will point to (e.g. `igw-9c26a123`) | string | - | yes |
13-
| label_order | The naming order of the id output and Name tag | list | `<list>` | no |
14-
| map_public_ip_on_launch | Instances launched into a public subnet should be assigned a public IP address | string | `true` | no |
15-
| max_subnet_count | Sets the maximum amount of subnets to deploy. 0 will deploy a subnet for every provided availablility zone (in `availability_zones` variable) within the region | string | `0` | no |
13+
| label_order | The naming order of the ID output and Name tag | list(string) | `<list>` | no |
14+
| map_public_ip_on_launch | Instances launched into a public subnet should be assigned a public IP address | bool | `true` | no |
15+
| max_subnet_count | Sets the maximum amount of subnets to deploy. 0 will deploy a subnet for every provided availablility zone (in `availability_zones` variable) within the region | string | `0` | no |
1616
| name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no |
1717
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
18-
| nat_gateway_enabled | Flag to enable/disable NAT Gateways to allow servers in the private subnets to access the Internet | string | `true` | no |
19-
| nat_instance_enabled | Flag to enable/disable NAT Instances to allow servers in the private subnets to access the Internet | string | `false` | no |
18+
| nat_gateway_enabled | Flag to enable/disable NAT Gateways to allow servers in the private subnets to access the Internet | bool | `true` | no |
19+
| nat_instance_enabled | Flag to enable/disable NAT Instances to allow servers in the private subnets to access the Internet | bool | `false` | no |
2020
| nat_instance_type | NAT Instance type | string | `t3.micro` | no |
2121
| private_network_acl_id | Network ACL ID that will be added to private subnets. If empty, a new ACL will be created | string | `` | no |
2222
| public_network_acl_id | Network ACL ID that will be added to public subnets. If empty, a new ACL will be created | string | `` | no |
2323
| regex_replace_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed | string | `/[^a-zA-Z0-9-]/` | no |
2424
| stage | Stage, e.g. 'prod', 'staging', 'dev', or 'test' | string | `` | no |
2525
| subnet_type_tag_key | Key for subnet type tag to provide information about the type of subnets, e.g. `cpco.io/subnet/type=private` or `cpco.io/subnet/type=public` | string | `cpco.io/subnet/type` | no |
2626
| subnet_type_tag_value_format | This is using the format interpolation symbols to allow the value of the subnet_type_tag_key to be modified. | string | `%s` | no |
27-
| tags | Additional tags to apply to all resources that use this label module | map | `<map>` | no |
27+
| tags | Additional tags to apply to all resources that use this label module | map(string) | `<map>` | no |
2828
| vpc_default_route_table_id | Default route table for public subnets. If not set, will be created. (e.g. `rtb-f4f0ce12`) | string | `` | no |
2929
| vpc_id | VPC ID where subnets will be created (e.g. `vpc-aceb2723`) | string | - | yes |
3030

examples/complete/fixtures.us-west-1.tfvars

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
max_availability_zones = 2
2-
31
region = "us-west-1"
42

53
availability_zones = ["us-west-1b", "us-west-1c"]

examples/complete/main.tf

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ module "vpc" {
55
aws = "aws"
66
}
77

8-
namespace = "${var.namespace}"
9-
stage = "${var.stage}"
10-
name = "${var.name}"
8+
namespace = var.namespace
9+
stage = var.stage
10+
name = var.name
1111
cidr_block = "172.16.0.0/16"
1212
}
1313

@@ -18,12 +18,14 @@ module "subnets" {
1818
aws = "aws"
1919
}
2020

21-
availability_zones = "${var.availability_zones}"
22-
namespace = "${var.namespace}"
23-
stage = "${var.stage}"
24-
name = "${var.name}"
25-
vpc_id = "${module.vpc.vpc_id}"
26-
igw_id = "${module.vpc.igw_id}"
27-
cidr_block = "${module.vpc.vpc_cidr_block}"
28-
nat_gateway_enabled = "true"
21+
region = var.region
22+
availability_zones = var.availability_zones
23+
namespace = var.namespace
24+
stage = var.stage
25+
name = var.name
26+
vpc_id = module.vpc.vpc_id
27+
igw_id = module.vpc.igw_id
28+
cidr_block = module.vpc.vpc_cidr_block
29+
nat_gateway_enabled = false
30+
nat_instance_enabled = false
2931
}

examples/complete/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
output "public_subnet_cidrs" {
2-
value = "${module.subnets.public_subnet_cidrs}"
2+
value = module.subnets.public_subnet_cidrs
33
}
44

55
output "private_subnet_cidrs" {
6-
value = "${module.subnets.private_subnet_cidrs}"
6+
value = module.subnets.private_subnet_cidrs
77
}

examples/complete/provider.tf

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

0 commit comments

Comments
 (0)