Skip to content

Commit

Permalink
r/aws_kinesis_analytics_application: Wait for correct status when upd…
Browse files Browse the repository at this point in the history
…ating running application.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSKinesisAnalyticsApplication_StartApplication_Update'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSKinesisAnalyticsApplication_StartApplication_Update -timeout 120m
=== RUN   TestAccAWSKinesisAnalyticsApplication_StartApplication_Update
=== PAUSE TestAccAWSKinesisAnalyticsApplication_StartApplication_Update
=== CONT  TestAccAWSKinesisAnalyticsApplication_StartApplication_Update
--- PASS: TestAccAWSKinesisAnalyticsApplication_StartApplication_Update (701.79s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	701.898s
  • Loading branch information
ewbankkit committed Mar 4, 2021
1 parent 3baa5b9 commit f4c556c
Show file tree
Hide file tree
Showing 2 changed files with 278 additions and 6 deletions.
36 changes: 36 additions & 0 deletions aws/resource_aws_kinesis_analytics_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error adding Kinesis Analytics Application (%s) CloudWatch logging option: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
} else if len(n.([]interface{})) == 0 {
// Delete existing CloudWatch logging options.
Expand All @@ -809,6 +813,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error deleting Kinesis Analytics Application (%s) CloudWatch logging option: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
} else {
// Update existing CloudWatch logging options.
Expand Down Expand Up @@ -854,6 +862,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error adding Kinesis Analytics Application (%s) input: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
} else if len(n.([]interface{})) == 0 {
// The existing input cannot be deleted.
Expand Down Expand Up @@ -887,6 +899,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error adding Kinesis Analytics Application (%s) input processing configuration: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
} else if len(n.([]interface{})) == 0 {
// Delete existing input processing configuration.
Expand All @@ -906,6 +922,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error deleting Kinesis Analytics Application (%s) input processing configuration: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
}
}
Expand Down Expand Up @@ -962,6 +982,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error deleting Kinesis Analytics Application (%s) output: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
}

Expand All @@ -983,6 +1007,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error adding Kinesis Analytics Application (%s) output: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
}
}
Expand All @@ -1008,6 +1036,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error adding Kinesis Analytics Application (%s) reference data source: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
} else if len(n.([]interface{})) == 0 {
// Delete existing reference data source.
Expand All @@ -1029,6 +1061,10 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
return fmt.Errorf("error deleting Kinesis Analytics Application (%s) reference data source: %w", d.Id(), err)
}

if _, err := waiter.ApplicationUpdated(conn, applicationName); err != nil {
return fmt.Errorf("error waiting for Kinesis Analytics Application (%s) to update: %w", d.Id(), err)
}

currentApplicationVersionId += 1
} else {
// Update existing reference data source.
Expand Down
Loading

0 comments on commit f4c556c

Please sign in to comment.