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

iam_account_alias: Pass awserr in returned error #3590

Merged

Conversation

Dominik-K
Copy link
Contributor

This will display helpful error messages like

The account alias ... already exists. (EntityAlreadyExists)

The error message is not red as it is common and useful in Terraform. Is there a setting for a resource that all returned errors are displayed in red?
Always setting the colorstring's [red], etc. on each error message is unnecessary boilerplate, I think.

@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Mar 1, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be very helpful for folks! Could you just use err instead of the custom function fmtAwsError(err) -- the awserr.Error type will return the right error message without extra logic.

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/iam Issues and PRs that pertain to the iam service. labels Mar 1, 2018
@Ninir Ninir added the waiting-response Maintainers are waiting on response from community or contributor. label Mar 2, 2018
@Dominik-K
Copy link
Contributor Author

@bflad Printing awserr.Error also shows the returned status code and request ID in an extra line. That's what I want to avoid. I think both should only be shown as a debug output. Most times it's not necessary. This would help to make Terraform output less (unnecessary) verbose, i.e. more actionable.

@bflad
Copy link
Contributor

bflad commented Mar 6, 2018

Some folks need this information for opening AWS support cases when its not possible to reproduce errors again with debug logging enabled.

This will display helpful error messages like
"The account alias ... already exists. (EntityAlreadyExists)"
@Dominik-K Dominik-K force-pushed the bugfix/r/iam_account_alias/error-message branch from c07c479 to b6b999f Compare March 6, 2018 13:25
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Mar 6, 2018
@Dominik-K
Copy link
Contributor Author

Right, I didn't think about Terraform used in a CI system. If you use it manually, you just could repeat the call with plan or apply. Anyway, it doesn't hurt that much ;-) Ok, I deleted fmtAwsError().

What about the red coloring output?

@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 6, 2018
@bflad bflad added this to the v1.11.0 milestone Mar 6, 2018
@bflad
Copy link
Contributor

bflad commented Mar 6, 2018

What about the red coloring output?

Probably worth a separate ticket. 😄 I'd be curious to see your opinion of what the implementation should look like and how it should be controlled. It most likely should be handled in Terraform core though since it sounds like it would apply for all Terraform providers/resources (AWS, GCP, Azure, etc.): https://github.com/hashicorp/terraform/

@bflad bflad self-requested a review March 6, 2018 14:25
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

=== RUN   TestAccAWSIAMAccountAlias
=== RUN   TestAccAWSIAMAccountAlias/Basic
=== RUN   TestAccAWSIAMAccountAlias/Basic/basic
=== RUN   TestAccAWSIAMAccountAlias/Import
=== RUN   TestAccAWSIAMAccountAlias/Import/import
--- PASS: TestAccAWSIAMAccountAlias (23.34s)
    --- PASS: TestAccAWSIAMAccountAlias/Basic (14.92s)
        --- PASS: TestAccAWSIAMAccountAlias/Basic/basic (14.92s)
    --- PASS: TestAccAWSIAMAccountAlias/Import (8.41s)
        --- PASS: TestAccAWSIAMAccountAlias/Import/import (8.41s)
PASS

@bflad bflad merged commit 70c5aeb into hashicorp:master Mar 6, 2018
bflad added a commit that referenced this pull request Mar 6, 2018
@bflad
Copy link
Contributor

bflad commented Mar 9, 2018

This has been released in version 1.11.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/iam Issues and PRs that pertain to the iam service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants