diff --git a/builtin/providers/aws/resource_aws_cloudformation_stack_test.go b/builtin/providers/aws/resource_aws_cloudformation_stack_test.go index 0c99f8d54..19b6f6c52 100644 --- a/builtin/providers/aws/resource_aws_cloudformation_stack_test.go +++ b/builtin/providers/aws/resource_aws_cloudformation_stack_test.go @@ -64,6 +64,31 @@ func TestAccAWSCloudFormation_allAttributes(t *testing.T) { }) } +// Regression for https://github.com/hashicorp/terraform/issues/4332 +func TestAccAWSCloudFormation_withParams(t *testing.T) { + var stack cloudformation.Stack + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSCloudFormationDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSCloudFormationConfig_withParams, + Check: resource.ComposeTestCheckFunc( + testAccCheckCloudFormationStackExists("aws_cloudformation_stack.with_params", &stack), + ), + }, + resource.TestStep{ + Config: testAccAWSCloudFormationConfig_withParams_modified, + Check: resource.ComposeTestCheckFunc( + testAccCheckCloudFormationStackExists("aws_cloudformation_stack.with_params", &stack), + ), + }, + }, + }) +} + func testAccCheckCloudFormationStackExists(n string, stack *cloudformation.Stack) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -225,3 +250,43 @@ resource "aws_sns_topic" "cf-updates" { name = "tf-cf-notifications" } ` + +var tpl_testAccAWSCloudFormationConfig_withParams = ` +resource "aws_cloudformation_stack" "with_params" { + name = "tf-stack-with-params" + parameters { + VpcCIDR = "%s" + } + template_body = <