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

Fix data source config formatting, 0.12 up to regions #14479

Merged
merged 1 commit into from
Aug 6, 2020
Merged
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
Fix data source config formatting, 0.12 up to regions
YakDriver committed Aug 5, 2020

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit ae3e1cffdc78e333c838821c2e284da78af80a3d
1 change: 1 addition & 0 deletions aws/data_source_aws_lambda_function_test.go
Original file line number Diff line number Diff line change
@@ -453,6 +453,7 @@ resource "aws_efs_access_point" "access_point_1" {

root_directory {
path = "/lambda"

creation_info {
owner_gid = 1000
owner_uid = 1000
1 change: 0 additions & 1 deletion aws/data_source_aws_launch_template_test.go
Original file line number Diff line number Diff line change
@@ -161,7 +161,6 @@ func TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress(t *testing.T) {
}

func TestAccAWSLaunchTemplateDataSource_NonExistent(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
14 changes: 7 additions & 7 deletions aws/data_source_aws_nat_gateway_test.go
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ resource "aws_vpc" "test" {
}

resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id
cidr_block = "172.%d.123.0/24"
availability_zone = "us-west-2a"

@@ -68,16 +68,16 @@ resource "aws_eip" "test" {

# IGWs are required for an NGW to spin up; manual dependency
resource "aws_internet_gateway" "test" {
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id

tags = {
Name = "terraform-testacc-nat-gateway-data-source-%d"
}
}

resource "aws_nat_gateway" "test" {
subnet_id = "${aws_subnet.test.id}"
allocation_id = "${aws_eip.test.id}"
subnet_id = aws_subnet.test.id
allocation_id = aws_eip.test.id

tags = {
Name = "terraform-testacc-nat-gw-data-source-%d"
@@ -88,16 +88,16 @@ resource "aws_nat_gateway" "test" {
}

data "aws_nat_gateway" "test_by_id" {
id = "${aws_nat_gateway.test.id}"
id = aws_nat_gateway.test.id
}

data "aws_nat_gateway" "test_by_subnet_id" {
subnet_id = "${aws_nat_gateway.test.subnet_id}"
subnet_id = aws_nat_gateway.test.subnet_id
}

data "aws_nat_gateway" "test_by_tags" {
tags = {
Name = "${aws_nat_gateway.test.tags["Name"]}"
Name = aws_nat_gateway.test.tags["Name"]
}
}
`, rInt, rInt, rInt, rInt)
8 changes: 4 additions & 4 deletions aws/data_source_aws_network_acls_test.go
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ resource "aws_vpc" "test" {
resource "aws_network_acl" "acl" {
count = 2

vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id

tags = {
Name = "testacc-acl-%s"
@@ -116,7 +116,7 @@ func testAccDataSourceAwsNetworkAclsConfig_Filter(rName string) string {
data "aws_network_acls" "test" {
filter {
name = "network-acl-id"
values = ["${aws_network_acl.acl.0.id}"]
values = [aws_network_acl.acl.0.id]
}
}
`
@@ -126,7 +126,7 @@ func testAccDataSourceAwsNetworkAclsConfig_Tags(rName string) string {
return testAccDataSourceAwsNetworkAclsConfig_Base(rName) + `
data "aws_network_acls" "test" {
tags = {
Name = "${aws_network_acl.acl.0.tags.Name}"
Name = aws_network_acl.acl.0.tags.Name
}
}
`
@@ -135,7 +135,7 @@ data "aws_network_acls" "test" {
func testAccDataSourceAwsNetworkAclsConfig_VpcID(rName string) string {
return testAccDataSourceAwsNetworkAclsConfig_Base(rName) + `
data "aws_network_acls" "test" {
vpc_id = "${aws_network_acl.acl.0.vpc_id}"
vpc_id = aws_network_acl.acl.0.vpc_id
}
`
}
24 changes: 12 additions & 12 deletions aws/data_source_aws_network_interface_test.go
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ resource "aws_vpc" "test" {

resource "aws_subnet" "test" {
cidr_block = "10.0.0.0/24"
availability_zone = "${data.aws_availability_zones.available.names[0]}"
vpc_id = "${aws_vpc.test.id}"
availability_zone = data.aws_availability_zones.available.names[0]
vpc_id = aws_vpc.test.id

tags = {
Name = "tf-acc-eni-data-source-basic"
@@ -64,17 +64,17 @@ resource "aws_subnet" "test" {

resource "aws_security_group" "test" {
name = "tf-sg-%s"
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id
}

resource "aws_network_interface" "test" {
subnet_id = "${aws_subnet.test.id}"
subnet_id = aws_subnet.test.id
private_ips = ["10.0.0.50"]
security_groups = ["${aws_security_group.test.id}"]
security_groups = [aws_security_group.test.id]
}

data "aws_network_interface" "test" {
id = "${aws_network_interface.test.id}"
id = aws_network_interface.test.id
}
`, rName)
}
@@ -117,8 +117,8 @@ resource "aws_vpc" "test" {

resource "aws_subnet" "test" {
cidr_block = "10.0.0.0/24"
availability_zone = "${data.aws_availability_zones.available.names[0]}"
vpc_id = "${aws_vpc.test.id}"
availability_zone = data.aws_availability_zones.available.names[0]
vpc_id = aws_vpc.test.id

tags = {
Name = "tf-acc-eni-data-source-filters"
@@ -127,19 +127,19 @@ resource "aws_subnet" "test" {

resource "aws_security_group" "test" {
name = "tf-sg-%s"
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id
}

resource "aws_network_interface" "test" {
subnet_id = "${aws_subnet.test.id}"
subnet_id = aws_subnet.test.id
private_ips = ["10.0.0.60"]
security_groups = ["${aws_security_group.test.id}"]
security_groups = [aws_security_group.test.id]
}

data "aws_network_interface" "test" {
filter {
name = "network-interface-id"
values = ["${aws_network_interface.test.id}"]
values = [aws_network_interface.test.id]
}
}
`, rName)
12 changes: 6 additions & 6 deletions aws/data_source_aws_network_interfaces_test.go
Original file line number Diff line number Diff line change
@@ -54,22 +54,22 @@ resource "aws_vpc" "test" {

resource "aws_subnet" "test" {
cidr_block = "10.0.0.0/24"
vpc_id = "${aws_vpc.test.id}"
vpc_id = aws_vpc.test.id

tags = {
Name = "terraform-testacc-eni-data-source-basic-%s"
}
}

resource "aws_network_interface" "test" {
subnet_id = "${aws_subnet.test.id}"
subnet_id = aws_subnet.test.id
}

resource "aws_network_interface" "test1" {
subnet_id = "${aws_subnet.test.id}"
subnet_id = aws_subnet.test.id

tags = {
Name = "${aws_vpc.test.tags.Name}"
Name = aws_vpc.test.tags.Name
}
}
`, rName, rName)
@@ -80,7 +80,7 @@ func testAccDataSourceAwsNetworkInterfacesConfig_Filter(rName string) string {
data "aws_network_interfaces" "test" {
filter {
name = "subnet-id"
values = ["${aws_network_interface.test.subnet_id}", "${aws_network_interface.test1.subnet_id}"]
values = [aws_network_interface.test.subnet_id, aws_network_interface.test1.subnet_id]
}
}
`
@@ -90,7 +90,7 @@ func testAccDataSourceAwsNetworkInterfacesConfig_Tags(rName string) string {
return testAccDataSourceAwsNetworkInterfacesConfig_Base(rName) + `
data "aws_network_interfaces" "test" {
tags = {
Name = "${aws_network_interface.test1.tags.Name}"
Name = aws_network_interface.test1.tags.Name
}
}
`
Original file line number Diff line number Diff line change
@@ -33,11 +33,11 @@ const testAccDataSourceAwsOrganizationsOrganizationalUnitsConfig = `
resource "aws_organizations_organization" "test" {}

resource "aws_organizations_organizational_unit" "test" {
name = "test"
parent_id = aws_organizations_organization.test.roots[0].id
name = "test"
parent_id = aws_organizations_organization.test.roots[0].id
}

data "aws_organizations_organizational_units" "test" {
parent_id = aws_organizations_organizational_unit.test.parent_id
parent_id = aws_organizations_organizational_unit.test.parent_id
}
`
2 changes: 1 addition & 1 deletion aws/data_source_aws_partition_test.go
Original file line number Diff line number Diff line change
@@ -61,5 +61,5 @@ func testAccCheckAwsDnsSuffix(n string) resource.TestCheckFunc {
}

const testAccCheckAwsPartitionConfig_basic = `
data "aws_partition" "current" { }
data "aws_partition" "current" {}
`
2 changes: 1 addition & 1 deletion aws/data_source_aws_prefix_list_test.go
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ data "aws_prefix_list" "s3_by_id" {
}

data "aws_prefix_list" "s3_by_name" {
name = "com.amazonaws.us-west-2.s3"
name = "com.amazonaws.us-west-2.s3"
}
`

100 changes: 51 additions & 49 deletions aws/data_source_aws_pricing_product_test.go
Original file line number Diff line number Diff line change
@@ -49,60 +49,62 @@ func TestAccDataSourceAwsPricingProduct_redshift(t *testing.T) {
}

func testAccDataSourceAwsPricingProductConfigEc2(dataName string, instanceType string) string {
return fmt.Sprintf(`data "aws_pricing_product" "%s" {
service_code = "AmazonEC2"

filters {
field = "instanceType"
value = "%s"
}

filters {
field = "operatingSystem"
value = "Linux"
}

filters {
field = "location"
value = "US East (N. Virginia)"
}

filters {
field = "preInstalledSw"
value = "NA"
}

filters {
field = "licenseModel"
value = "No License required"
}

filters {
field = "tenancy"
value = "Shared"
}

filters {
field = "capacitystatus"
value = "Used"
}
return fmt.Sprintf(`
data "aws_pricing_product" "%s" {
service_code = "AmazonEC2"

filters {
field = "instanceType"
value = "%s"
}

filters {
field = "operatingSystem"
value = "Linux"
}

filters {
field = "location"
value = "US East (N. Virginia)"
}

filters {
field = "preInstalledSw"
value = "NA"
}

filters {
field = "licenseModel"
value = "No License required"
}

filters {
field = "tenancy"
value = "Shared"
}

filters {
field = "capacitystatus"
value = "Used"
}
}
`, dataName, instanceType)
}

func testAccDataSourceAwsPricingProductConfigRedshift() string {
return `data "aws_pricing_product" "test" {
service_code = "AmazonRedshift"

filters {
field = "instanceType"
value = "ds1.xlarge"
}

filters {
field = "location"
value = "US East (N. Virginia)"
}
return `
data "aws_pricing_product" "test" {
service_code = "AmazonRedshift"

filters {
field = "instanceType"
value = "ds1.xlarge"
}

filters {
field = "location"
value = "US East (N. Virginia)"
}
}
`
}
10 changes: 5 additions & 5 deletions aws/data_source_aws_qldb_ledger_test.go
Original file line number Diff line number Diff line change
@@ -31,22 +31,22 @@ func TestAccDataSourceAwsQLDBLedger_basic(t *testing.T) {
func testAccDataSourceAwsQLDBLedgerConfig(rName string) string {
return fmt.Sprintf(`
resource "aws_qldb_ledger" "tf_wrong1" {
name = "%[1]s1"
name = "%[1]s1"
deletion_protection = false
}

resource "aws_qldb_ledger" "tf_test" {
name = "%[1]s2"
name = "%[1]s2"
deletion_protection = false
}

resource "aws_qldb_ledger" "tf_wrong2" {
name = "%[1]s3"
deletion_protection = false
name = "%[1]s3"
deletion_protection = false
}

data "aws_qldb_ledger" "by_name" {
name = "${aws_qldb_ledger.tf_test.name}"
name = aws_qldb_ledger.tf_test.name
}
`, rName)
}
Loading