mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #1304 from hashicorp/b-aws-vpc-modify-attr-req
providers/aws: fix DNS options on VPC
This commit is contained in:
commit
396b082c20
@ -185,13 +185,13 @@ func resourceAwsVpcUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||||||
// Turn on partial mode
|
// Turn on partial mode
|
||||||
d.Partial(true)
|
d.Partial(true)
|
||||||
vpcid := d.Id()
|
vpcid := d.Id()
|
||||||
modifyOpts := &ec2.ModifyVPCAttributeRequest{
|
|
||||||
VPCID: &vpcid,
|
|
||||||
}
|
|
||||||
if d.HasChange("enable_dns_hostnames") {
|
if d.HasChange("enable_dns_hostnames") {
|
||||||
val := d.Get("enable_dns_hostnames").(bool)
|
val := d.Get("enable_dns_hostnames").(bool)
|
||||||
modifyOpts.EnableDNSHostnames = &ec2.AttributeBooleanValue{
|
modifyOpts := &ec2.ModifyVPCAttributeRequest{
|
||||||
Value: &val,
|
VPCID: &vpcid,
|
||||||
|
EnableDNSHostnames: &ec2.AttributeBooleanValue{
|
||||||
|
Value: &val,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf(
|
log.Printf(
|
||||||
@ -205,9 +205,12 @@ func resourceAwsVpcUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("enable_dns_support") {
|
if d.HasChange("enable_dns_support") {
|
||||||
val := d.Get("enable_dns_hostnames").(bool)
|
val := d.Get("enable_dns_support").(bool)
|
||||||
modifyOpts.EnableDNSSupport = &ec2.AttributeBooleanValue{
|
modifyOpts := &ec2.ModifyVPCAttributeRequest{
|
||||||
Value: &val,
|
VPCID: &vpcid,
|
||||||
|
EnableDNSSupport: &ec2.AttributeBooleanValue{
|
||||||
|
Value: &val,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf(
|
log.Printf(
|
||||||
|
@ -2,11 +2,12 @@ package aws
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/aws-sdk-go/aws"
|
"github.com/hashicorp/aws-sdk-go/aws"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/ec2"
|
"github.com/hashicorp/aws-sdk-go/gen/ec2"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccVpc_basic(t *testing.T) {
|
func TestAccVpc_basic(t *testing.T) {
|
||||||
@ -184,6 +185,26 @@ func testAccCheckVpcExists(n string, vpc *ec2.VPC) resource.TestCheckFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/hashicorp/terraform/issues/1301
|
||||||
|
func TestAccVpc_bothDnsOptionsSet(t *testing.T) {
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckVpcDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccVpcConfig_BothDnsOptions,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"aws_vpc.bar", "enable_dns_hostnames", "true"),
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"aws_vpc.bar", "enable_dns_support", "true"),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const testAccVpcConfig = `
|
const testAccVpcConfig = `
|
||||||
resource "aws_vpc" "foo" {
|
resource "aws_vpc" "foo" {
|
||||||
cidr_block = "10.1.0.0/16"
|
cidr_block = "10.1.0.0/16"
|
||||||
@ -223,3 +244,12 @@ resource "aws_vpc" "bar" {
|
|||||||
cidr_block = "10.2.0.0/16"
|
cidr_block = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const testAccVpcConfig_BothDnsOptions = `
|
||||||
|
resource "aws_vpc" "bar" {
|
||||||
|
cidr_block = "10.2.0.0/16"
|
||||||
|
|
||||||
|
enable_dns_hostnames = true
|
||||||
|
enable_dns_support = true
|
||||||
|
}
|
||||||
|
`
|
||||||
|
Loading…
Reference in New Issue
Block a user