Skip to content

Commit 2b69f73

Browse files
committed
Mock iam_endpoint explicitly for testing with localstack
Starting from Terraform v1.6, the s3 backend configuration has changed, and this caused the acceptance test to fail. We can workaround the issue by specifying the `iam_endpoint`. The `iam_endpoint` argument has been deprecated since Terraformv1.6. It is recommended to use the newly added `endpoints` argument, though, for running tests on multiple Terraform versions, the test settings must remain compatible with the older versions. This is a test-only issue, so I'll use the deprecated `iam_endpoint` for now. FYI: minamijoyo/tfmigrate@7591205
1 parent be4b1d7 commit 2b69f73

File tree

18 files changed

+72
-36
lines changed

18 files changed

+72
-36
lines changed

filter/awsv4upgrade/provider_aws_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ provider "aws" {
4141
4242
# mock endpoints with localstack
4343
endpoints {
44-
s3 = "http://localstack:4566"
44+
s3 = "http://localstack:4566"
45+
iam = "http://localstack:4566"
4546
}
4647
4748
s3_force_path_style = true
@@ -61,7 +62,8 @@ provider "aws" {
6162
6263
# mock endpoints with localstack
6364
endpoints {
64-
s3 = "http://localstack:4566"
65+
s3 = "http://localstack:4566"
66+
iam = "http://localstack:4566"
6567
}
6668
6769
s3_use_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/acceleration_status/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/acl/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/cors_rule/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/count/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/for_each/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/full/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/grant/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/lifecycle_rule/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

test-fixtures/awsv4upgrade/aws_s3_bucket/logging/config.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ terraform {
55
bucket = "tfstate-test"
66
key = "test/terraform.tfstate"
77

8-
# mock s3 endpoint with localstack
8+
# mock s3/iam endpoint with localstack
99
endpoint = "http://localstack:4566"
10+
iam_endpoint = "http://localstack:4566"
1011
access_key = "dummy"
1112
secret_key = "dummy"
1213
skip_credentials_validation = true
@@ -36,7 +37,8 @@ provider "aws" {
3637

3738
# mock endpoints with localstack
3839
endpoints {
39-
s3 = "http://localstack:4566"
40+
s3 = "http://localstack:4566"
41+
iam = "http://localstack:4566"
4042
}
4143

4244
s3_force_path_style = true

0 commit comments

Comments
 (0)