From 6899246b98d2b103a7eeaeb1608ad814aef80188 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Fri, 5 Aug 2016 18:44:10 +1000 Subject: [PATCH] provider/aws: Updates `aws_cloudformation_stack` Update timeout (#7997) Fixes #7996 The Create func was using the timeout that we were passing to the resource. Update func was not. ``` % make testacc TEST=./builtin/providers/aws % TESTARGS='-run=TestAccAWSCloudFormation_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSCloudFormation_ -timeout 120m === RUN TestAccAWSCloudFormation_basic --- PASS: TestAccAWSCloudFormation_basic (120.61s) === RUN TestAccAWSCloudFormation_defaultParams --- PASS: TestAccAWSCloudFormation_defaultParams (121.40s) === RUN TestAccAWSCloudFormation_allAttributes --- PASS: TestAccAWSCloudFormation_allAttributes (263.29s) === RUN TestAccAWSCloudFormation_withParams --- PASS: TestAccAWSCloudFormation_withParams (205.52s) === RUN TestAccAWSCloudFormation_withUrl_withParams --- PASS: TestAccAWSCloudFormation_withUrl_withParams (402.71s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1113.552s ``` --- .../providers/aws/resource_aws_cloudformation_stack.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_cloudformation_stack.go b/builtin/providers/aws/resource_aws_cloudformation_stack.go index 28935e33c..56249587b 100644 --- a/builtin/providers/aws/resource_aws_cloudformation_stack.go +++ b/builtin/providers/aws/resource_aws_cloudformation_stack.go @@ -268,6 +268,7 @@ func resourceAwsCloudFormationStackRead(d *schema.ResourceData, meta interface{} } func resourceAwsCloudFormationStackUpdate(d *schema.ResourceData, meta interface{}) error { + retryTimeout := int64(30) conn := meta.(*AWSClient).cfconn input := &cloudformation.UpdateStackInput{ @@ -314,6 +315,13 @@ func resourceAwsCloudFormationStackUpdate(d *schema.ResourceData, meta interface return err } + if v, ok := d.GetOk("timeout_in_minutes"); ok { + m := int64(v.(int)) + if m > retryTimeout { + retryTimeout = m + 5 + log.Printf("[DEBUG] CloudFormation timeout: %d", retryTimeout) + } + } wait := resource.StateChangeConf{ Pending: []string{ "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS", @@ -323,7 +331,7 @@ func resourceAwsCloudFormationStackUpdate(d *schema.ResourceData, meta interface "UPDATE_ROLLBACK_COMPLETE", }, Target: []string{"UPDATE_COMPLETE"}, - Timeout: 15 * time.Minute, + Timeout: time.Duration(retryTimeout) * time.Minute, MinTimeout: 5 * time.Second, Refresh: func() (interface{}, string, error) { resp, err := conn.DescribeStacks(&cloudformation.DescribeStacksInput{