mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 08:51:02 -06:00
providers/aws: vpc dns settings tests
cc/ @deoxxa see diff for how to add tests – quite straight forward. Normally, I would like to add a check to ensure that the attribute was updated remotely (by seeing what it's value with AWS is) but I don't think we have that value returned.
This commit is contained in:
parent
53cdbcc9fa
commit
6eb6d19384
@ -25,6 +25,8 @@ IMPROVEMENTS:
|
||||
attributes.
|
||||
* providers/aws: Security group rules can be updated without a
|
||||
destroy/create.
|
||||
* providers/aws: You can enable and disable dns settings for VPCs
|
||||
[GH-172]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
@ -30,6 +30,35 @@ func TestAccVpc(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccVpcUpdate(t *testing.T) {
|
||||
var vpc ec2.VPC
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckVpcDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccVpcConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckVpcExists("aws_vpc.foo", &vpc),
|
||||
testAccCheckVpcCidr(&vpc, "10.1.0.0/16"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"aws_vpc.foo", "cidr_block", "10.1.0.0/16"),
|
||||
),
|
||||
},
|
||||
resource.TestStep{
|
||||
Config: testAccVpcConfigUpdate,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckVpcExists("aws_vpc.foo", &vpc),
|
||||
resource.TestCheckResourceAttr(
|
||||
"aws_vpc.foo", "enable_dns_hostnames", "true"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckVpcDestroy(s *terraform.State) error {
|
||||
conn := testAccProvider.ec2conn
|
||||
|
||||
@ -102,3 +131,10 @@ resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccVpcConfigUpdate = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
enable_dns_hostnames = true
|
||||
}
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user