Skip to content

Commit

Permalink
r/aws_volume_attachment: Replace 'data aws_ec2_instance_type_offering…
Browse files Browse the repository at this point in the history
… available {}' with 'testAccAvailableEc2InstanceTypeForAvailabilityZone'.
  • Loading branch information
ewbankkit committed Jul 27, 2020
1 parent 93e3c07 commit 51c697b
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions aws/resource_aws_volume_attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ func testAccCheckVolumeAttachmentDestroy(s *terraform.State) error {
}

func testAccVolumeAttachmentInstanceOnlyConfigBase(rName string) string {
return testAccLatestAmazonLinuxHvmEbsAmiConfig() + fmt.Sprintf(`
return composeConfig(
testAccLatestAmazonLinuxHvmEbsAmiConfig(),
testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"),
fmt.Sprintf(`
data "aws_availability_zones" "available" {
state = "available"
Expand All @@ -279,16 +282,6 @@ data "aws_availability_zones" "available" {
}
}
data "aws_ec2_instance_type_offering" "available" {
filter {
name = "instance-type"
values = ["t3.micro", "t2.micro"]
}
location_type = "availability-zone"
preferred_instance_types = ["t3.micro", "t2.micro"]
}
resource "aws_instance" "test" {
ami = "${data.aws_ami.amzn-ami-minimal-hvm-ebs.id}"
availability_zone = "${data.aws_availability_zones.available.names[0]}"
Expand All @@ -298,7 +291,7 @@ resource "aws_instance" "test" {
Name = %[1]q
}
}
`, rName)
`, rName))
}

func testAccVolumeAttachmentConfigBase(rName string) string {
Expand Down

0 comments on commit 51c697b

Please sign in to comment.