@@ -4394,7 +4394,7 @@ func TestAccEC2Instance_metadataOptions(t *testing.T) {
4394
4394
Steps : []resource.TestStep {
4395
4395
{
4396
4396
Config : testAccInstanceConfig_metadataOptions (rName ),
4397
- Check : resource .ComposeTestCheckFunc (
4397
+ Check : resource .ComposeAggregateTestCheckFunc (
4398
4398
testAccCheckInstanceExists (resourceName , & v ),
4399
4399
resource .TestCheckResourceAttr (resourceName , "metadata_options.#" , "1" ),
4400
4400
resource .TestCheckResourceAttr (resourceName , "metadata_options.0.http_endpoint" , "disabled" ),
@@ -4405,7 +4405,7 @@ func TestAccEC2Instance_metadataOptions(t *testing.T) {
4405
4405
},
4406
4406
{
4407
4407
Config : testAccInstanceConfig_metadataOptionsUpdated (rName ),
4408
- Check : resource .ComposeTestCheckFunc (
4408
+ Check : resource .ComposeAggregateTestCheckFunc (
4409
4409
testAccCheckInstanceExists (resourceName , & v ),
4410
4410
resource .TestCheckResourceAttr (resourceName , "metadata_options.#" , "1" ),
4411
4411
resource .TestCheckResourceAttr (resourceName , "metadata_options.0.http_endpoint" , "enabled" ),
@@ -4414,6 +4414,17 @@ func TestAccEC2Instance_metadataOptions(t *testing.T) {
4414
4414
resource .TestCheckResourceAttr (resourceName , "metadata_options.0.instance_metadata_tags" , "enabled" ),
4415
4415
),
4416
4416
},
4417
+ {
4418
+ Config : testAccInstanceConfig_metadataOptionsUpdatedAgain (rName ),
4419
+ Check : resource .ComposeAggregateTestCheckFunc (
4420
+ testAccCheckInstanceExists (resourceName , & v ),
4421
+ resource .TestCheckResourceAttr (resourceName , "metadata_options.#" , "1" ),
4422
+ resource .TestCheckResourceAttr (resourceName , "metadata_options.0.http_endpoint" , "enabled" ),
4423
+ resource .TestCheckResourceAttr (resourceName , "metadata_options.0.http_tokens" , "optional" ),
4424
+ resource .TestCheckResourceAttr (resourceName , "metadata_options.0.http_put_response_hop_limit" , "1" ),
4425
+ resource .TestCheckResourceAttr (resourceName , "metadata_options.0.instance_metadata_tags" , "disabled" ),
4426
+ ),
4427
+ },
4417
4428
{
4418
4429
ResourceName : resourceName ,
4419
4430
ImportState : true ,
@@ -7691,6 +7702,31 @@ resource "aws_instance" "test" {
7691
7702
` , rName ))
7692
7703
}
7693
7704
7705
+ func testAccInstanceConfig_metadataOptionsUpdatedAgain (rName string ) string {
7706
+ return acctest .ConfigCompose (
7707
+ acctest .ConfigLatestAmazonLinuxHVMEBSAMI (),
7708
+ testAccInstanceVPCConfig (rName , false , 0 ),
7709
+ acctest .AvailableEC2InstanceTypeForRegion ("t3.micro" , "t2.micro" ),
7710
+ fmt .Sprintf (`
7711
+ resource "aws_instance" "test" {
7712
+ ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id
7713
+ instance_type = data.aws_ec2_instance_type_offering.available.instance_type
7714
+ subnet_id = aws_subnet.test.id
7715
+
7716
+ tags = {
7717
+ Name = %[1]q
7718
+ }
7719
+
7720
+ metadata_options {
7721
+ http_endpoint = "enabled"
7722
+ http_tokens = "optional"
7723
+ http_put_response_hop_limit = 1
7724
+ instance_metadata_tags = "disabled"
7725
+ }
7726
+ }
7727
+ ` , rName ))
7728
+ }
7729
+
7694
7730
func testAccInstanceConfig_enclaveOptions (rName string , enabled bool ) string {
7695
7731
return acctest .ConfigCompose (
7696
7732
acctest .ConfigLatestAmazonLinuxHVMEBSAMI (),
0 commit comments