Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: surface licencemanager InvalidParameterValueException error #32845

Merged
merged 6 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/32845.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_licensemanager_license_configuration: Surface `InvalidParameterValueException` errors during resource Delete
```
10 changes: 4 additions & 6 deletions internal/service/licensemanager/license_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand All @@ -186,7 +184,7 @@ func resourceLicenseConfigurationDelete(ctx context.Context, d *schema.ResourceD
LicenseConfigurationArn: aws.String(d.Id()),
})

if tfawserr.ErrCodeEquals(err, licensemanager.ErrCodeInvalidParameterValueException) {
if tfawserr.ErrMessageContains(err, licensemanager.ErrCodeInvalidParameterValueException, "Invalid license configuration ARN") {
return nil
}

Expand All @@ -204,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,
Expand Down
Loading