From 3faa96108e58ee95c7241b8726b635b6e30954ee Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Wed, 27 Mar 2024 16:27:19 -0400 Subject: [PATCH] r/aws_applicationinsights_application: ACTIVE is a valid create target status (#36615) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some configurations with `auto_config_enabled = true`, intermittent errors are observed waiting for application creation. ``` │ Error: waiting for ApplicationInsights Application (example) create: unexpected state 'ACTIVE', wanted target 'NOT_CONFIGURED'. last error: %!s() ``` The current assumption is that all applications enter a `NOT_CONFIGURED` lifecycle status upon initial creation (which is why this succeeds most of the time in minimal configurations such as our acceptance test), but in some instances can proceed into an `ACTIVE` status before the create waiter has polled for and observed a `NOT_CONFIGURED` status. The AWS documentation on the [LifeCycle argument](https://docs.aws.amazon.com/cloudwatch/latest/APIReference/API_ApplicationInfo.html#appinsights-Type-ApplicationInfo-LifeCycle) is limited, so while we cannot be certain about the expected values in the lifecycle flow, there is enough evidence from issue reports and manual testing to indicate `ACTIVE` should be considered a valid target state. ```console % make testacc PKG=applicationinsights TESTS=TestAccApplicationInsightsApplication_ ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.21.8 test ./internal/service/applicationinsights/... -v -count 1 -parallel 20 -run='TestAccApplicationInsightsApplication_' -timeout 360m --- PASS: TestAccApplicationInsightsApplication_disappears (22.83s) --- PASS: TestAccApplicationInsightsApplication_autoConfig (25.47s) --- PASS: TestAccApplicationInsightsApplication_basic (34.21s) --- PASS: TestAccApplicationInsightsApplication_tags (43.17s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/applicationinsights 48.867s ``` --- .changelog/36615.txt | 3 +++ internal/service/applicationinsights/wait.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .changelog/36615.txt diff --git a/.changelog/36615.txt b/.changelog/36615.txt new file mode 100644 index 00000000000..20cd7b061b0 --- /dev/null +++ b/.changelog/36615.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_applicationinsights_application: Make `ACTIVE` a valid create target status +``` diff --git a/internal/service/applicationinsights/wait.go b/internal/service/applicationinsights/wait.go index 0a82c082373..20654f43caf 100644 --- a/internal/service/applicationinsights/wait.go +++ b/internal/service/applicationinsights/wait.go @@ -20,7 +20,7 @@ const ( func waitApplicationCreated(ctx context.Context, conn *applicationinsights.ApplicationInsights, name string) (*applicationinsights.ApplicationInfo, error) { stateConf := &retry.StateChangeConf{ Pending: []string{"CREATING"}, - Target: []string{"NOT_CONFIGURED"}, + Target: []string{"NOT_CONFIGURED", "ACTIVE"}, Refresh: statusApplication(ctx, conn, name), Timeout: ApplicationCreatedTimeout, }