Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add integration test for map[string]string attr #1104

Merged
merged 3 commits into from
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/sourcegraph/jsonrpc2 v0.0.0-20190106185902-35a74f039c6a
github.com/spf13/afero v1.2.2 // matches version used by terraform
github.com/terraform-linters/tflint-plugin-sdk v0.8.2
github.com/terraform-linters/tflint-ruleset-aws v0.3.1
github.com/terraform-linters/tflint-ruleset-aws v0.3.2-0.20210424063642-35a8256b9439
github.com/zclconf/go-cty v1.8.1
golang.org/x/lint v0.0.0-20200302205851-738671d3881b
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ github.com/tencentcloud/tencentcloud-sdk-go v3.0.82+incompatible/go.mod h1:0PfYo
github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c/go.mod h1:wk2XFUg6egk4tSDNZtXeKfe2G6690UVyt163PuUxBZk=
github.com/terraform-linters/tflint-plugin-sdk v0.8.2 h1:A46VFbdBH8K1JwFjC4X5hbW35oL6gIoRxjlzzz27q7I=
github.com/terraform-linters/tflint-plugin-sdk v0.8.2/go.mod h1:UsVDOw0Urg0POULWugZ6XFzWJ6i0NaTFYtlYrQe4Auw=
github.com/terraform-linters/tflint-ruleset-aws v0.3.1 h1:ipsJto4kbVBUdt12E+r1uLTJV/nAkg3zzm2F/y7qYxQ=
github.com/terraform-linters/tflint-ruleset-aws v0.3.1/go.mod h1:8XZ7U81vk51+NGE76ygQKtVEhNP6tuI+m0UFB205jTI=
github.com/terraform-linters/tflint-ruleset-aws v0.3.2-0.20210424063642-35a8256b9439 h1:mWefOM7fzpMpNYJYfm0CGT9zmAs9Z8DoFC2ac52QnxM=
github.com/terraform-linters/tflint-ruleset-aws v0.3.2-0.20210424063642-35a8256b9439/go.mod h1:8XZ7U81vk51+NGE76ygQKtVEhNP6tuI+m0UFB205jTI=
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20210401223222-6eda2394d8c0/go.mod h1:zHbWVcgJdvGPS7TgOYxr1p2Fgrtok7rVw9EOhSgtC9M=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tombuildsstuff/giovanni v0.15.1/go.mod h1:0TZugJPEtqzPlMpuJHYfXY6Dq2uLPrXf98D2XQSxNbA=
Expand Down
8 changes: 7 additions & 1 deletion integrationtest/bundled/bundled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ func TestBundledPlugin(t *testing.T) {
Command: "tflint --format json --force",
Dir: "cty-based-eval",
},
{
// Regression: https://github.com/terraform-linters/tflint/issues/1102
Name: "map-attribute",
Command: "tflint --format json --force",
Dir: "map-attribute",
},
}

dir, _ := os.Getwd()
Expand All @@ -84,7 +90,7 @@ func TestBundledPlugin(t *testing.T) {
cmd.Stderr = errStream

if err := cmd.Run(); err != nil {
panic(fmt.Sprintf("Failed to exec command: %s", err))
fmt.Fprintf(os.Stderr, "Failed to exec command (%s)\n", err)
}

var b []byte
Expand Down
4 changes: 4 additions & 0 deletions integrationtest/bundled/map-attribute/.tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rule "aws_resource_missing_tags" {
enabled = true
tags = ["Environment", "Name", "Type"]
}
25 changes: 25 additions & 0 deletions integrationtest/bundled/map-attribute/result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"issues": [
{
"rule": {
"name": "aws_resource_missing_tags",
"severity": "info",
"link": "https://github.com/terraform-linters/tflint-ruleset-aws/blob/v0.3.1/docs/rules/aws_resource_missing_tags.md"
},
"message": "The resource is missing the following tags: \"Environment\", \"Name\", \"Type\".",
"range": {
"filename": "template.tf",
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 25
}
},
"callers": []
}
],
"errors": []
}
3 changes: 3 additions & 0 deletions integrationtest/bundled/map-attribute/template.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resource "aws_instance" "intance" {
tags = { foo = "bar" }
}