@@ -60,3 +60,36 @@ func TestExamplesComplete(t *testing.T) {
6060 expectedPublicSubnetCidrs := []string {"172.16.96.0/19" , "172.16.128.0/19" }
6161 assert .Equal (t , expectedPublicSubnetCidrs , publicSubnetCidrs )
6262}
63+
64+ func TestExamplesCompleteDisabled (t * testing.T ) {
65+ t .Parallel ()
66+ randID := strings .ToLower (random .UniqueId ())
67+ attributes := []string {randID }
68+
69+ rootFolder := "../../"
70+ terraformFolderRelativeToRoot := "examples/complete"
71+ varFiles := []string {"fixtures.us-east-2.tfvars" }
72+
73+ tempTestFolder := test_structure .CopyTerraformFolderToTemp (t , rootFolder , terraformFolderRelativeToRoot )
74+
75+ terraformOptions := & terraform.Options {
76+ // The path to where our Terraform code is located
77+ TerraformDir : tempTestFolder ,
78+ Upgrade : true ,
79+ // Variables to pass to our Terraform code using -var-file options
80+ VarFiles : varFiles ,
81+ Vars : map [string ]interface {}{
82+ "attributes" : attributes ,
83+ "enabled" : "false" ,
84+ },
85+ }
86+
87+ // At the end of the test, run `terraform destroy` to clean up any resources that were created
88+ defer cleanup (t , terraformOptions , tempTestFolder )
89+
90+ // This will run `terraform init` and `terraform apply` and fail the test if there are any errors
91+ results := terraform .InitAndApply (t , terraformOptions )
92+
93+ // Should complete successfully without creating or changing any resources
94+ assert .Contains (t , results , "Resources: 0 added, 0 changed, 0 destroyed." )
95+ }
0 commit comments