Skip to content

Commit 6e32f47

Browse files
authored
Support AWS Provider V5 (#72)
* Support AWS Provider V5 * bump tf * versions * versions * versions * bump aws * update docs * sync test with alb
1 parent afb0809 commit 6e32f47

File tree

12 files changed

+1683
-41
lines changed

12 files changed

+1683
-41
lines changed

.github/workflows/release-branch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'docs/**'
1111
- 'examples/**'
1212
- 'test/**'
13+
- 'README.*'
1314

1415
permissions:
1516
contents: write

.github/workflows/release-published.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ permissions:
1111

1212
jobs:
1313
terraform-module:
14-
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
14+
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-published.yml@main

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ Available targets:
220220

221221
| Name | Version |
222222
|------|---------|
223-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
224-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.42 |
223+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
224+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |
225225

226226
## Providers
227227

228228
| Name | Version |
229229
|------|---------|
230-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.42 |
230+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0 |
231231

232232
## Modules
233233

docs/terraform.md

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

44
| Name | Version |
55
|------|---------|
6-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.42 |
6+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
7+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |
88

99
## Providers
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.42 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0 |
1414

1515
## Modules
1616

examples/complete/main.tf

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@ provider "aws" {
33
}
44

55
module "vpc" {
6-
source = "cloudposse/vpc/aws"
7-
version = "0.18.0"
8-
9-
cidr_block = var.vpc_cidr_block
10-
11-
context = module.this.context
6+
source = "cloudposse/vpc/aws"
7+
version = "2.1.0"
8+
ipv4_primary_cidr_block = var.vpc_cidr_block
9+
context = module.this.context
1210
}
1311

1412
module "subnets" {
15-
source = "cloudposse/dynamic-subnets/aws"
16-
version = "0.31.0"
17-
13+
source = "cloudposse/dynamic-subnets/aws"
14+
version = "2.3.0"
1815
availability_zones = var.availability_zones
1916
vpc_id = module.vpc.vpc_id
20-
igw_id = module.vpc.igw_id
21-
cidr_block = module.vpc.vpc_cidr_block
17+
igw_id = [module.vpc.igw_id]
18+
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
2219
nat_gateway_enabled = false
2320
nat_instance_enabled = false
24-
25-
context = module.this.context
21+
context = module.this.context
2622
}
2723

2824
module "alb" {
2925
source = "cloudposse/alb/aws"
30-
version = "0.21.0"
26+
version = "1.8.0"
3127

3228
vpc_id = module.vpc.vpc_id
3329
security_group_ids = [module.vpc.vpc_default_security_group_id]

examples/complete/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 0.13.0"
2+
required_version = ">= 1.0"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 2.42"
7+
version = ">= 4.0"
88
}
99
}
1010
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
locals {
2-
target_group_arn = var.default_target_group_enabled ? join("", aws_lb_target_group.default.*.arn) : var.target_group_arn
2+
target_group_arn = var.default_target_group_enabled ? join("", aws_lb_target_group.default[*].arn) : var.target_group_arn
33
}
44

55
data "aws_lb_target_group" "default" {

outputs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
output "target_group_name" {
22
description = "ALB Target Group name"
3-
value = join("", data.aws_lb_target_group.default.*.name)
3+
value = join("", data.aws_lb_target_group.default[*].name)
44
}
55

66
output "target_group_arn" {
77
description = "ALB Target Group ARN"
8-
value = join("", data.aws_lb_target_group.default.*.arn)
8+
value = join("", data.aws_lb_target_group.default[*].arn)
99
}
1010

1111
output "target_group_arn_suffix" {
1212
description = "ALB Target Group ARN suffix"
13-
value = join("", data.aws_lb_target_group.default.*.arn_suffix)
13+
value = join("", data.aws_lb_target_group.default[*].arn_suffix)
1414
}

test/src/examples_complete_test.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,46 @@
11
package test
22

33
import (
4+
"os"
5+
"strings"
46
"testing"
57

8+
"github.com/gruntwork-io/terratest/modules/random"
69
"github.com/gruntwork-io/terratest/modules/terraform"
10+
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
711
"github.com/stretchr/testify/assert"
8-
"math/rand"
9-
"strconv"
10-
"time"
1112
)
1213

14+
func cleanup(t *testing.T, terraformOptions *terraform.Options, tempTestFolder string) {
15+
terraform.Destroy(t, terraformOptions)
16+
os.RemoveAll(tempTestFolder)
17+
}
18+
1319
// Test the Terraform module in examples/complete using Terratest.
1420
func TestExamplesComplete(t *testing.T) {
1521
t.Parallel()
16-
rand.Seed(time.Now().UnixNano())
22+
randID := strings.ToLower(random.UniqueId())
23+
attributes := []string{randID}
24+
25+
rootFolder := "../../"
26+
terraformFolderRelativeToRoot := "examples/complete"
27+
varFiles := []string{"fixtures.us-east-2.tfvars"}
1728

18-
attributes := []string{strconv.Itoa(rand.Intn(100000))}
29+
tempTestFolder := test_structure.CopyTerraformFolderToTemp(t, rootFolder, terraformFolderRelativeToRoot)
1930

2031
terraformOptions := &terraform.Options{
2132
// The path to where our Terraform code is located
22-
TerraformDir: "../../examples/complete",
33+
TerraformDir: tempTestFolder,
2334
Upgrade: true,
2435
// Variables to pass to our Terraform code using -var-file options
25-
VarFiles: []string{"fixtures.us-east-2.tfvars"},
36+
VarFiles: varFiles,
2637
Vars: map[string]interface{}{
2738
"attributes": attributes,
2839
},
2940
}
3041

3142
// At the end of the test, run `terraform destroy` to clean up any resources that were created
32-
defer terraform.Destroy(t, terraformOptions)
43+
defer cleanup(t, terraformOptions, tempTestFolder)
3344

3445
// This will run `terraform init` and `terraform apply` and fail the test if there are any errors
3546
terraform.InitAndApply(t, terraformOptions)

test/src/go.mod

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,104 @@
1-
module github.com/cloudposse/terraform-aws-alb-ingress
1+
module github.com/cloudposse/terraform-aws-alb
22

3-
go 1.14
3+
go 1.17
44

55
require (
6-
github.com/gruntwork-io/terratest v0.30.23
7-
github.com/stretchr/testify v1.6.1
6+
github.com/gruntwork-io/terratest v0.43.0
7+
github.com/stretchr/testify v1.8.1
8+
)
9+
10+
require (
11+
cloud.google.com/go v0.105.0 // indirect
12+
cloud.google.com/go/compute v1.12.1 // indirect
13+
cloud.google.com/go/compute/metadata v0.2.1 // indirect
14+
cloud.google.com/go/iam v0.7.0 // indirect
15+
cloud.google.com/go/storage v1.27.0 // indirect
16+
github.com/agext/levenshtein v1.2.3 // indirect
17+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
18+
github.com/aws/aws-sdk-go v1.44.122 // indirect
19+
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
20+
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
21+
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
22+
github.com/davecgh/go-spew v1.1.1 // indirect
23+
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
24+
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
25+
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
26+
github.com/go-logr/logr v1.2.3 // indirect
27+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
28+
github.com/go-openapi/jsonreference v0.20.1 // indirect
29+
github.com/go-openapi/swag v0.22.3 // indirect
30+
github.com/go-sql-driver/mysql v1.4.1 // indirect
31+
github.com/gogo/protobuf v1.3.2 // indirect
32+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
33+
github.com/golang/protobuf v1.5.3 // indirect
34+
github.com/golang/snappy v0.0.3 // indirect
35+
github.com/google/gnostic v0.5.7-v3refs // indirect
36+
github.com/google/go-cmp v0.5.9 // indirect
37+
github.com/google/gofuzz v1.1.0 // indirect
38+
github.com/google/uuid v1.3.0 // indirect
39+
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
40+
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
41+
github.com/googleapis/gnostic v0.4.1 // indirect
42+
github.com/gruntwork-io/go-commons v0.8.0 // indirect
43+
github.com/hashicorp/errwrap v1.0.0 // indirect
44+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
45+
github.com/hashicorp/go-getter v1.7.1 // indirect
46+
github.com/hashicorp/go-multierror v1.1.0 // indirect
47+
github.com/hashicorp/go-safetemp v1.0.0 // indirect
48+
github.com/hashicorp/go-version v1.6.0 // indirect
49+
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
50+
github.com/hashicorp/terraform-json v0.13.0 // indirect
51+
github.com/imdario/mergo v0.3.11 // indirect
52+
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
53+
github.com/jmespath/go-jmespath v0.4.0 // indirect
54+
github.com/josharian/intern v1.0.0 // indirect
55+
github.com/json-iterator/go v1.1.12 // indirect
56+
github.com/jstemmer/go-junit-report v0.9.1 // indirect
57+
github.com/klauspost/compress v1.15.11 // indirect
58+
github.com/mailru/easyjson v0.7.7 // indirect
59+
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
60+
github.com/mitchellh/go-homedir v1.1.0 // indirect
61+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
62+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
63+
github.com/moby/spdystream v0.2.0 // indirect
64+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
65+
github.com/modern-go/reflect2 v1.0.2 // indirect
66+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
67+
github.com/pmezard/go-difflib v1.0.0 // indirect
68+
github.com/pquerna/otp v1.2.0 // indirect
69+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
70+
github.com/spf13/pflag v1.0.5 // indirect
71+
github.com/tmccombs/hcl2json v0.3.3 // indirect
72+
github.com/ulikunitz/xz v0.5.10 // indirect
73+
github.com/urfave/cli v1.22.2 // indirect
74+
github.com/zclconf/go-cty v1.9.1 // indirect
75+
go.opencensus.io v0.24.0 // indirect
76+
golang.org/x/crypto v0.1.0 // indirect
77+
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
78+
golang.org/x/mod v0.9.0 // indirect
79+
golang.org/x/net v0.8.0 // indirect
80+
golang.org/x/oauth2 v0.1.0 // indirect
81+
golang.org/x/sys v0.6.0 // indirect
82+
golang.org/x/term v0.6.0 // indirect
83+
golang.org/x/text v0.8.0 // indirect
84+
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
85+
golang.org/x/tools v0.7.0 // indirect
86+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
87+
google.golang.org/api v0.103.0 // indirect
88+
google.golang.org/appengine v1.6.7 // indirect
89+
google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c // indirect
90+
google.golang.org/grpc v1.51.0 // indirect
91+
google.golang.org/protobuf v1.28.1 // indirect
92+
gopkg.in/inf.v0 v0.9.1 // indirect
93+
gopkg.in/yaml.v2 v2.4.0 // indirect
94+
gopkg.in/yaml.v3 v3.0.1 // indirect
95+
k8s.io/api v0.27.2 // indirect
96+
k8s.io/apimachinery v0.27.2 // indirect
97+
k8s.io/client-go v0.27.2 // indirect
98+
k8s.io/klog/v2 v2.90.1 // indirect
99+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
100+
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
101+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
102+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
103+
sigs.k8s.io/yaml v1.3.0 // indirect
8104
)

0 commit comments

Comments
 (0)