From f2669aa05c61a84f0a8e5086119466fe9993e77a Mon Sep 17 00:00:00 2001 From: Albert Silva Date: Thu, 3 Aug 2023 12:31:50 -0400 Subject: [PATCH 1/4] surface InvalidParameterValueException errors --- internal/service/licensemanager/license_configuration.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/service/licensemanager/license_configuration.go b/internal/service/licensemanager/license_configuration.go index 731afcefc0a..29eaf314a53 100644 --- a/internal/service/licensemanager/license_configuration.go +++ b/internal/service/licensemanager/license_configuration.go @@ -183,10 +183,6 @@ func resourceLicenseConfigurationDelete(ctx context.Context, d *schema.ResourceD LicenseConfigurationArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, licensemanager.ErrCodeInvalidParameterValueException) { - return nil - } - if err != nil { return diag.Errorf("deleting License Manager License Configuration (%s): %s", d.Id(), err) } From a63552ff7c25ba65d2c953f7ae3d15154e8641d9 Mon Sep 17 00:00:00 2001 From: Albert Silva Date: Thu, 3 Aug 2023 12:41:15 -0400 Subject: [PATCH 2/4] add changelog --- .changelog/32845.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/32845.txt diff --git a/.changelog/32845.txt b/.changelog/32845.txt new file mode 100644 index 00000000000..434daf8179c --- /dev/null +++ b/.changelog/32845.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_licensemanager_license_configuration: Surface InvalidParameterValueException errors during destruction of the resource +``` \ No newline at end of file From 980a0da32d6d792ceab8c43bbf4b1c1de0735681 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 23 Aug 2023 10:49:40 -0400 Subject: [PATCH 3/4] Tweak CHANGELOG entry. --- .changelog/32845.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/32845.txt b/.changelog/32845.txt index 434daf8179c..6de8f2b2fb2 100644 --- a/.changelog/32845.txt +++ b/.changelog/32845.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/aws_licensemanager_license_configuration: Surface InvalidParameterValueException errors during destruction of the resource +resource/aws_licensemanager_license_configuration: Surface `InvalidParameterValueException` errors during resource Delete ``` \ No newline at end of file From 188734fc0b81c2bb033a3587e7155515a68b4642 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 23 Aug 2023 10:55:15 -0400 Subject: [PATCH 4/4] r/aws_licensemanager_license_configuration: Better handling of non-existant configurations. --- .../service/licensemanager/license_configuration.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/service/licensemanager/license_configuration.go b/internal/service/licensemanager/license_configuration.go index 79972047de5..01e9fd19ec6 100644 --- a/internal/service/licensemanager/license_configuration.go +++ b/internal/service/licensemanager/license_configuration.go @@ -111,14 +111,13 @@ func resourceLicenseConfigurationCreate(ctx context.Context, d *schema.ResourceD input.LicenseRules = flex.ExpandStringList(v.([]interface{})) } - log.Printf("[DEBUG] Creating License Manager License Configuration: %s", input) - resp, err := conn.CreateLicenseConfigurationWithContext(ctx, input) + output, err := conn.CreateLicenseConfigurationWithContext(ctx, input) if err != nil { return diag.Errorf("creating License Manager License Configuration (%s): %s", name, err) } - d.SetId(aws.StringValue(resp.LicenseConfigurationArn)) + d.SetId(aws.StringValue(output.LicenseConfigurationArn)) return resourceLicenseConfigurationRead(ctx, d, meta) } @@ -167,7 +166,6 @@ func resourceLicenseConfigurationUpdate(ctx context.Context, d *schema.ResourceD input.LicenseCount = aws.Int64(int64(v.(int))) } - log.Printf("[DEBUG] Updating License Manager License Configuration: %s", input) _, err := conn.UpdateLicenseConfigurationWithContext(ctx, input) if err != nil { @@ -186,6 +184,10 @@ func resourceLicenseConfigurationDelete(ctx context.Context, d *schema.ResourceD LicenseConfigurationArn: aws.String(d.Id()), }) + if tfawserr.ErrMessageContains(err, licensemanager.ErrCodeInvalidParameterValueException, "Invalid license configuration ARN") { + return nil + } + if err != nil { return diag.Errorf("deleting License Manager License Configuration (%s): %s", d.Id(), err) } @@ -200,7 +202,7 @@ func FindLicenseConfigurationByARN(ctx context.Context, conn *licensemanager.Lic output, err := conn.GetLicenseConfigurationWithContext(ctx, input) - if tfawserr.ErrCodeEquals(err, licensemanager.ErrCodeInvalidParameterValueException) { + if tfawserr.ErrMessageContains(err, licensemanager.ErrCodeInvalidParameterValueException, "Invalid license configuration ARN") { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input,