Skip to content

Commit 9fbda14

Browse files
adenotIgor J. Santosigorjs
authored
Pump terraform required version and remove experiments (continuing from #46) (#52)
* Pump terraform required version and remove experiments * Pump terraform required version and remove experiments * terraform-docs: automated update action * Update README.md Signed-off-by: igor.js <[email protected]> * Update README.md Signed-off-by: igor.js <[email protected]> * terraform-docs: automated update action --------- Signed-off-by: igor.js <[email protected]> Co-authored-by: Igor J. Santos <[email protected]> Co-authored-by: igor.js <[email protected]> Co-authored-by: igorjs <[email protected]> Co-authored-by: adenot <[email protected]>
1 parent 70c082c commit 9fbda14

File tree

14 files changed

+87
-93
lines changed

14 files changed

+87
-93
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
docs:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v3
99
with:
1010
ref: ${{ github.head_ref }}
1111

.github/workflows/lint.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,36 @@ jobs:
77
name: Lint
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@master
11-
- name: TFLint
12-
uses: docker://wata727/tflint
10+
- uses: actions/checkout@v3
11+
- uses: actions/cache@v3
12+
with:
13+
path: ~/.tflint.d/plugins
14+
key: tflint-${{ hashFiles('.tflint.hcl') }}
15+
- uses: terraform-linters/setup-tflint@v3
16+
- run: tflint --version
17+
- run: tflint --init
18+
- run: tflint -f compact
1319

1420
fmt:
1521
name: Code Format
1622
runs-on: ubuntu-latest
1723
container:
1824
image: hashicorp/terraform:latest
1925
steps:
20-
- uses: actions/checkout@master
26+
- uses: actions/checkout@v3
2127
- run: terraform fmt --recursive -check=true
2228

2329
validate:
2430
name: Validate
2531
runs-on: ubuntu-latest
2632
container:
27-
image: hashicorp/terraform:0.14.0
33+
image: hashicorp/terraform:1.5.1
2834
steps:
29-
- uses: actions/checkout@master
35+
- uses: actions/checkout@v3
3036
- name: Validate Code
3137
env:
3238
AWS_REGION: 'us-east-1'
3339
TF_WARN_OUTPUT_ERRORS: 1
34-
TF_VAR_vpc_id: 'vpc-123456'
35-
TF_VAR_subnets: '["subnet-12345a"]'
36-
TF_VAR_workers_ami_id: 'ami-123456'
37-
TF_VAR_cluster_name: 'test_cluster'
3840
run: |
3941
terraform init
4042
terraform validate
@@ -51,14 +53,14 @@ jobs:
5153
name: Minimum version check
5254
runs-on: ubuntu-latest
5355
container:
54-
image: hashicorp/terraform:0.14.0
56+
image: hashicorp/terraform:1.5.1
5557
steps:
56-
- uses: actions/checkout@master
58+
- uses: actions/checkout@v3
5759
- name: Validate Code
5860
env:
5961
AWS_REGION: 'us-east-1'
6062
TF_WARN_OUTPUT_ERRORS: 1
6163
run: |
6264
sed -i -e 's/>=/=/' -e 's/ \(\d\+\.\d\+\)"/ \1.0"/' versions.tf
6365
terraform init
64-
terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster"
66+
terraform validate

.tflint.hcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rule "terraform_required_providers" {
2+
enabled = false
3+
}

README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The following resources will be created:
2929

3030
```hcl
3131
module "network" {
32-
source = "git::https://github.com/DNXLabs/terraform-aws-network.git?ref=0.0.3"
32+
source = "git::https://github.com/DNXLabs/terraform-aws-network.git?ref=2.0.0"
3333
3434
vpc_cidr = "10.1.0.0/16"
3535
newbits = 8 # will create /24 subnets
@@ -44,8 +44,8 @@ module "network" {
4444

4545
| Name | Version |
4646
|------|---------|
47-
| terraform | >= 1.3.0 |
48-
| terraform | >= 0.14.0 |
47+
| terraform | >= 1.5.1 |
48+
| terraform | >= 1.5.1 |
4949

5050
## Providers
5151

@@ -72,7 +72,7 @@ module "network" {
7272
| kubernetes\_clusters\_type | Use either 'owned' or 'shared' for kubernetes cluster tags | `string` | `"shared"` | no |
7373
| max\_az | Max number of AZs | `number` | `3` | no |
7474
| multi\_nat | Number of NAT Instances, 'true' will yield one per AZ while 'false' creates one NAT | `bool` | `false` | no |
75-
| name | Name prefix for the resources of this stack | `any` | n/a | yes |
75+
| name | Name prefix for the resources of this stack | `string` | n/a | yes |
7676
| name\_pattern | Name pattern to use for resources. Options: default, kebab | `string` | `"default"` | no |
7777
| name\_suffix | Adds a name suffix to all resources created | `string` | `""` | no |
7878
| nat | Deploy NAT instance(s) | `bool` | `true` | no |
@@ -91,18 +91,9 @@ module "network" {
9191
| transit\_nacl\_inbound\_udp\_ports | UDP Ports to allow inbound on transit subnet via NACLs (this list cannot be empty) | `list(string)` | <pre>[<br> "1194"<br>]</pre> | no |
9292
| transit\_netnum\_offset | Start with this subnet for secure ones, plus number of AZs | `number` | `15` | no |
9393
| transit\_subnet | Create a transit subnet for VPC peering (only central account) | `bool` | `false` | no |
94-
| vpc\_cidr | Network CIDR for the VPC | `any` | n/a | yes |
94+
| vpc\_cidr | Network CIDR for the VPC | `string` | n/a | yes |
9595
| vpc\_cidr\_summ | Define cidr used to summarize subnets by tier | `string` | `"/0"` | no |
96-
| vpc\_cidr\_transit | Network CIDR for Transit subnets | `string` | `"10.255.255.0/24"` | no |
9796
| vpc\_endpoint\_dynamodb\_gateway | Enable or disable VPC Endpoint for DynamoDB (Gateway) | `bool` | `true` | no |
98-
| vpc\_endpoint\_dynamodb\_policy | A policy to attach to the endpoint that controls access to the service | `string` | `" {
99-
\"Statement\": [
100-
{
101-
\"Action\": \"*\",\"Effect\": \"Allow\",\"Resource\": \"*\",\"Principal\": \"*\"
102-
}
103-
]
104-
}
105-
"` | no |
10697
| vpc\_endpoint\_s3\_gateway | Enable or disable VPC Endpoint for S3 Gateway | `bool` | `true` | no |
10798
| vpc\_endpoint\_s3\_policy | A policy to attach to the endpoint that controls access to the service | `string` | `" {
10899
\"Statement\": [

_outputs.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,47 @@ output "internet_gateway_id" {
1414
}
1515

1616
output "public_subnet_ids" {
17-
value = aws_subnet.public.*.id
17+
value = aws_subnet.public[*].id
1818
description = "List of public subnet IDs"
1919
}
2020

2121
output "public_subnet_cidrs" {
22-
value = aws_subnet.public.*.cidr_block
22+
value = aws_subnet.public[*].cidr_block
2323
description = "List of public subnet CIDRs"
2424
}
2525

2626
output "firewall_subnet_cidrs" {
27-
value = aws_subnet.firewall.*.cidr_block
27+
value = aws_subnet.firewall[*].cidr_block
2828
description = "List of firewall subnet CIDRs"
2929
}
3030

3131
output "firewall_subnet_ids" {
32-
value = aws_subnet.firewall.*.id
32+
value = aws_subnet.firewall[*].id
3333
description = "List of firewall subnet IDs"
3434
}
3535

3636
output "private_subnet_ids" {
37-
value = aws_subnet.private.*.id
37+
value = aws_subnet.private[*].id
3838
description = "List of private subnet IDs"
3939
}
4040

4141
output "private_subnet_cidrs" {
42-
value = aws_subnet.private.*.cidr_block
42+
value = aws_subnet.private[*].cidr_block
4343
description = "List of private subnet CIDRs"
4444
}
4545

4646
output "secure_subnet_ids" {
47-
value = aws_subnet.secure.*.id
47+
value = aws_subnet.secure[*].id
4848
description = "List of secure subnet IDs"
4949
}
5050

5151
output "secure_subnet_cidrs" {
52-
value = aws_subnet.secure.*.cidr_block
52+
value = aws_subnet.secure[*].cidr_block
5353
description = "List of secure subnet CIDRs"
5454
}
5555

5656
output "nat_gateway_ids" {
57-
value = aws_nat_gateway.nat_gw.*.id
57+
value = aws_nat_gateway.nat_gw[*].id
5858
description = "List of NAT Gateway IDs"
5959
}
6060

@@ -67,15 +67,15 @@ output "public_route_table_id" {
6767
}
6868

6969
output "private_route_table_id" {
70-
value = aws_route_table.private.*.id
70+
value = aws_route_table.private[*].id
7171
}
7272

7373
output "secure_route_table_id" {
7474
value = aws_route_table.secure.id
7575
}
7676

7777
output "transit_route_table_id" {
78-
value = aws_route_table.transit.*.id
78+
value = aws_route_table.transit[*].id
7979
}
8080

8181
output "public_nacl_id" {
@@ -91,7 +91,7 @@ output "secure_nacl_id" {
9191
}
9292

9393
output "transit_nacl_id" {
94-
value = aws_network_acl.transit.*.id
94+
value = aws_network_acl.transit[*].id
9595
}
9696

9797
output "private_subnets" {

_variables.tf

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.5.1"
33
}
44

55
variable "max_az" {
6+
type = number
67
default = 3
78
description = "Max number of AZs"
89
}
910

1011
variable "name" {
12+
type = string
1113
description = "Name prefix for the resources of this stack"
1214
}
1315

1416
variable "cf_export_name" {
17+
type = string
1518
default = ""
1619
description = "Name prefix for the export resources of the cloud formation output"
1720
}
1821

1922
variable "vpc_cidr" {
23+
type = string
2024
description = "Network CIDR for the VPC"
2125
}
2226

23-
variable "vpc_cidr_transit" {
24-
default = "10.255.255.0/24"
25-
description = "Network CIDR for Transit subnets"
26-
}
27-
2827
variable "nat" {
28+
type = bool
2929
default = true
3030
description = "Deploy NAT instance(s)"
3131
}
3232

3333
variable "multi_nat" {
34+
type = bool
3435
default = false
3536
description = "Number of NAT Instances, 'true' will yield one per AZ while 'false' creates one NAT"
3637
}
3738

3839
variable "newbits" {
40+
type = number
3941
default = 5
4042
description = "Number of bits to add to the vpc cidr when building subnets"
4143
}
@@ -53,26 +55,31 @@ variable "tags" {
5355
}
5456

5557
variable "public_netnum_offset" {
58+
type = number
5659
default = 0
5760
description = "Start with this subnet for public ones, plus number of AZs"
5861
}
5962

6063
variable "private_netnum_offset" {
64+
type = number
6165
default = 5
6266
description = "Start with this subnet for private ones, plus number of AZs"
6367
}
6468

6569
variable "secure_netnum_offset" {
70+
type = number
6671
default = 10
6772
description = "Start with this subnet for secure ones, plus number of AZs"
6873
}
6974

7075
variable "transit_netnum_offset" {
76+
type = number
7177
default = 15
7278
description = "Start with this subnet for secure ones, plus number of AZs"
7379
}
7480

7581
variable "firewall_netnum_offset" {
82+
type = number
7683
default = 14
7784
description = "Start with this subnet for secure ones, plus number of AZs"
7885
}
@@ -90,6 +97,7 @@ variable "firewall_custom_rule_arn" {
9097
}
9198

9299
variable "transit_subnet" {
100+
type = bool
93101
default = false
94102
description = "Create a transit subnet for VPC peering (only central account)"
95103
}
@@ -137,11 +145,13 @@ variable "transit_nacl_inbound_udp_ports" {
137145
}
138146

139147
variable "vpc_flow_logs" {
148+
type = bool
140149
default = true
141150
description = "Enable or disable VPC Flow Logs"
142151
}
143152

144153
variable "vpc_flow_logs_retention" {
154+
type = number
145155
default = 365
146156
description = "Retention in days for VPC Flow Logs CloudWatch Log Group"
147157
}
@@ -159,19 +169,7 @@ variable "vpc_endpoint_dynamodb_gateway" {
159169
}
160170

161171
variable "vpc_endpoint_s3_policy" {
162-
default = <<POLICY
163-
{
164-
"Statement": [
165-
{
166-
"Action": "*","Effect": "Allow","Resource": "*","Principal": "*"
167-
}
168-
]
169-
}
170-
POLICY
171-
description = "A policy to attach to the endpoint that controls access to the service"
172-
}
173-
174-
variable "vpc_endpoint_dynamodb_policy" {
172+
type = string
175173
default = <<POLICY
176174
{
177175
"Statement": [

cf-exports.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ resource "aws_cloudformation_stack" "tf_exports" {
66
"VpcId" = aws_vpc.default.id,
77
"CidrBlock" = aws_vpc.default.cidr_block,
88
"InternetGatewayId" = aws_internet_gateway.default.id,
9-
"PublicSubnetIds" = join(",", aws_subnet.public.*.id),
10-
"PublicSubnetCidrs" = join(",", aws_subnet.public.*.cidr_block),
11-
"PrivateSubnetIds" = join(",", aws_subnet.private.*.id),
12-
"PrivateSubnetCidrs" = join(",", aws_subnet.private.*.cidr_block),
13-
"SecureSubnetIds" = join(",", aws_subnet.secure.*.id),
14-
"SecureSubnetCidrs" = join(",", aws_subnet.secure.*.cidr_block),
15-
"NatGatewayIds" = var.nat ? join(",", aws_nat_gateway.nat_gw.*.id) : "undefined",
9+
"PublicSubnetIds" = join(",", aws_subnet.public[*].id),
10+
"PublicSubnetCidrs" = join(",", aws_subnet.public[*].cidr_block),
11+
"PrivateSubnetIds" = join(",", aws_subnet.private[*].id),
12+
"PrivateSubnetCidrs" = join(",", aws_subnet.private[*].cidr_block),
13+
"SecureSubnetIds" = join(",", aws_subnet.secure[*].id),
14+
"SecureSubnetCidrs" = join(",", aws_subnet.secure[*].cidr_block),
15+
"NatGatewayIds" = var.nat ? join(",", aws_nat_gateway.nat_gw[*].id) : "undefined",
1616
"DbSubnetGroupId" = aws_db_subnet_group.secure.id
1717
}
1818
})

db-subnet.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_db_subnet_group" "secure" {
22
name = lower(format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix))
3-
subnet_ids = aws_subnet.secure.*.id
3+
subnet_ids = aws_subnet.secure[*].id
44

55
tags = merge(
66
var.tags,

0 commit comments

Comments
 (0)