Skip to content

Commit

Permalink
Merge pull request #14483 from terraform-providers/td-config-format-ds7
Browse files Browse the repository at this point in the history
Fix data source test configs (up to s3 bucket)
  • Loading branch information
YakDriver authored Aug 6, 2020
2 parents c0f2194 + 124d5d8 commit 43d37bf
Show file tree
Hide file tree
Showing 18 changed files with 201 additions and 190 deletions.
1 change: 0 additions & 1 deletion aws/data_source_aws_autoscaling_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ resource "aws_autoscaling_group" "barbaz" {
}
data "aws_autoscaling_groups" "group_list" {
filter {
name = "key"
values = ["Foo"]
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_availability_zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ data "aws_availability_zones" "test" {
}
data "aws_availability_zone" "test" {
filter {
name = "zone-name"
values = [data.aws_availability_zones.test.names[0]]
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_availability_zones_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ data "aws_availability_zones" "test" {
func testAccCheckAwsAvailabilityZonesConfigFilter() string {
return `
data "aws_availability_zones" "test" {
filter {
name = "state"
values = ["available"]
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_ebs_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ resource "aws_ebs_snapshot" "test" {
}
data "aws_ebs_snapshot" "test" {
filter {
name = "snapshot-id"
values = [aws_ebs_snapshot.test.id]
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_ebs_volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func testAccDataSourceAwsEbsVolumeIDsConfigWithDataSource(rInt int) string {
%s
data "aws_ebs_volumes" "subject_under_test" {
tags = {
TestIdentifierSet = "testAccDataSourceAwsEbsVolumes-%d"
}
Expand Down
4 changes: 4 additions & 0 deletions aws/data_source_aws_elasticsearch_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ POLICY
instance_type = "t2.small.elasticsearch"
instance_count = 2
dedicated_master_enabled = false
zone_awareness_config {
availability_zone_count = 2
}
zone_awareness_enabled = true
}
Expand Down Expand Up @@ -238,9 +240,11 @@ POLICY
instance_type = "t2.small.elasticsearch"
instance_count = 2
dedicated_master_enabled = false
zone_awareness_config {
availability_zone_count = 2
}
zone_awareness_enabled = true
}
Expand Down
161 changes: 80 additions & 81 deletions aws/data_source_aws_iam_policy_document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,89 +367,89 @@ var testAccAWSIAMPolicyDocumentExpectedJSON = `{

var testAccAWSIAMPolicyDocumentSourceConfig = `
data "aws_iam_policy_document" "test" {
policy_id = "policy_id"
policy_id = "policy_id"
statement {
sid = "1"
actions = [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation",
]
resources = [
"arn:aws:s3:::*",
]
}
statement {
sid = "1"
actions = [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation",
]
resources = [
"arn:aws:s3:::*",
]
}
statement {
actions = [
"s3:ListBucket",
]
statement {
actions = [
"s3:ListBucket",
]
resources = [
"arn:aws:s3:::foo",
]
resources = [
"arn:aws:s3:::foo",
]
condition {
test = "StringLike"
variable = "s3:prefix"
values = [
"home/",
"home/&{aws:username}/",
]
}
condition {
test = "StringLike"
variable = "s3:prefix"
values = [
"home/",
"home/&{aws:username}/",
]
}
not_principals {
type = "AWS"
identifiers = ["arn:blahblah:example"]
}
not_principals {
type = "AWS"
identifiers = ["arn:blahblah:example"]
}
}
statement {
actions = [
"s3:*",
]
statement {
actions = [
"s3:*",
]
resources = [
"arn:aws:s3:::foo/home/&{aws:username}",
"arn:aws:s3:::foo/home/&{aws:username}/*",
]
resources = [
"arn:aws:s3:::foo/home/&{aws:username}",
"arn:aws:s3:::foo/home/&{aws:username}/*",
]
principals {
type = "AWS"
identifiers = [
"arn:blahblah:example",
"arn:blahblahblah:example",
]
}
principals {
type = "AWS"
identifiers = [
"arn:blahblah:example",
"arn:blahblahblah:example",
]
}
}
statement {
effect = "Deny"
not_actions = ["s3:*"]
not_resources = ["arn:aws:s3:::*"]
}
statement {
effect = "Deny"
not_actions = ["s3:*"]
not_resources = ["arn:aws:s3:::*"]
}
# Normalization of wildcard principals
# Normalization of wildcard principals
statement {
effect = "Allow"
actions = ["kinesis:*"]
statement {
effect = "Allow"
actions = ["kinesis:*"]
principals {
type = "AWS"
identifiers = ["*"]
}
principals {
type = "AWS"
identifiers = ["*"]
}
}
statement {
effect = "Allow"
actions = ["firehose:*"]
statement {
effect = "Allow"
actions = ["firehose:*"]
principals {
type = "*"
identifiers = ["*"]
}
principals {
type = "*"
identifiers = ["*"]
}
}
}
data "aws_iam_policy_document" "test_source" {
Expand Down Expand Up @@ -595,7 +595,6 @@ var testAccAWSIAMPolicyDocumentSourceConflictingExpectedJSON = `{

var testAccAWSIAMPolicyDocumentOverrideConfig = `
data "aws_iam_policy_document" "override" {
statement {
sid = "SidToOverwrite"
Expand Down Expand Up @@ -646,22 +645,22 @@ var testAccAWSIAMPolicyDocumentOverrideExpectedJSON = `{
var testAccAWSIAMPolicyDocumentNoStatementMergeConfig = `
data "aws_iam_policy_document" "source" {
statement {
sid = ""
sid = ""
actions = ["ec2:DescribeAccountAttributes"]
resources = ["*"]
}
}
data "aws_iam_policy_document" "override" {
statement {
sid = "OverridePlaceholder"
sid = "OverridePlaceholder"
actions = ["s3:GetObject"]
resources = ["*"]
}
}
data "aws_iam_policy_document" "yak_politik" {
source_json = data.aws_iam_policy_document.source.json
source_json = data.aws_iam_policy_document.source.json
override_json = data.aws_iam_policy_document.override.json
}
`
Expand All @@ -687,22 +686,22 @@ var testAccAWSIAMPolicyDocumentNoStatementMergeExpectedJSON = `{
var testAccAWSIAMPolicyDocumentNoStatementOverrideConfig = `
data "aws_iam_policy_document" "source" {
statement {
sid = "OverridePlaceholder"
sid = "OverridePlaceholder"
actions = ["ec2:DescribeAccountAttributes"]
resources = ["*"]
}
}
data "aws_iam_policy_document" "override" {
statement {
sid = "OverridePlaceholder"
sid = "OverridePlaceholder"
actions = ["s3:GetObject"]
resources = ["*"]
}
}
data "aws_iam_policy_document" "yak_politik" {
source_json = data.aws_iam_policy_document.source.json
source_json = data.aws_iam_policy_document.source.json
override_json = data.aws_iam_policy_document.override.json
}
`
Expand All @@ -722,16 +721,16 @@ var testAccAWSIAMPolicyDocumentNoStatementOverrideExpectedJSON = `{
var testAccAWSIAMPolicyDocumentDuplicateSidConfig = `
data "aws_iam_policy_document" "test" {
statement {
sid = "1"
effect = "Allow"
actions = ["ec2:DescribeAccountAttributes"]
sid = "1"
effect = "Allow"
actions = ["ec2:DescribeAccountAttributes"]
resources = ["*"]
}
statement {
sid = "1"
effect = "Allow"
actions = ["s3:GetObject"]
sid = "1"
effect = "Allow"
actions = ["s3:GetObject"]
resources = ["*"]
}
}
Expand Down Expand Up @@ -777,7 +776,7 @@ const testAccAWSIAMPolicyDocumentDataSourceConfigVersion20081017 = `
data "aws_iam_policy_document" "test" {
version = "2008-10-17"
statement {
statement {
actions = ["ec2:*"]
resources = ["*"]
}
Expand All @@ -800,12 +799,12 @@ const testAccAWSIAMPolicyDocumentDataSourceConfigVersion20081017ConversionCondit
data "aws_iam_policy_document" "test" {
version = "2008-10-17"
statement {
statement {
actions = ["*"]
resources = ["*"]
condition {
test = "StringLike"
test = "StringLike"
values = [
"home/",
"home/&{aws:username}/",
Expand Down
2 changes: 1 addition & 1 deletion aws/data_source_aws_kms_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "aws_kms_key" "test" {
}
data "aws_kms_key" "test" {
key_id = "${aws_kms_key.test.key_id}"
key_id = aws_kms_key.test.key_id
}
`, rName)
}
4 changes: 2 additions & 2 deletions aws/data_source_aws_route53_delegation_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ resource "aws_route53_delegation_set" "dset" {
resource "aws_route53_zone" "primary" {
name = "example.xyz"
delegation_set_id = "${aws_route53_delegation_set.dset.id}"
delegation_set_id = aws_route53_delegation_set.dset.id
}
data "aws_route53_delegation_set" "dset" {
id = "${aws_route53_delegation_set.dset.id}"
id = aws_route53_delegation_set.dset.id
}
`
Loading

0 comments on commit 43d37bf

Please sign in to comment.