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

Honor async.error settings from api.yaml in Terraform providers #12431

Closed
melinath opened this issue Aug 30, 2022 · 4 comments
Closed

Honor async.error settings from api.yaml in Terraform providers #12431

melinath opened this issue Aug 30, 2022 · 4 comments
Labels
mmv1-generator Provider-wide changes to resource templates or other generator changes service/terraform size/m technical-debt
Milestone

Comments

@melinath
Copy link
Collaborator

It looks like the operation error options that you can set in api.yaml don't actually get used anywhere - for example: https://github.com/GoogleCloudPlatform/magic-modules/blob/065f680d36c0a653e9d8542257d60663f96c15c5/mmv1/products/datastream/api.yaml#L40

it looks like the actually operation error just gets wrapped in CommonOpError which just always uses e.Message:

return fmt.Sprintf("Error code %v, message: %s", e.Code, e.Message)

This breaks down if the error message is in a different place - for example:

...
"error": {
    "code": 9,
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "POSTGRES_CONNECTION_ERROR",
        "domain": "datastream.googleapis.com",
        "metadata": {
          "message": "An unexpected database connection error occurred while trying to connect to the data source. Make sure that the connection profile configuration is correct, or contact Google Support.",
          "uuid": "de7cb468-4c56-49ec-a32b-09a396f2ecf0",
          "time": "2022-08-30T17:37:43.192113Z",
          "originalMessage": "timeout expired\n"
        }
      }
    ]
  }
...

This ends up getting displayed as:

Error: Error waiting to create ConnectionProfile: Error waiting for Creating ConnectionProfile: Error code 9, message: 

Expected Behavior

We should be honoring the async.error settings so that autogenerated resources can compensate for different operation error structures.

@melinath melinath added technical-debt mmv1-generator Provider-wide changes to resource templates or other generator changes labels Aug 30, 2022
@melinath
Copy link
Collaborator Author

melinath commented Aug 30, 2022

The workaround is to turn off autogen_async and handwrite the operations code. There are currently ~13 handwritten operations files.

@rileykarson rileykarson added this to the Backlog milestone Sep 6, 2022
@rileykarson
Copy link
Collaborator

Based on the number of wrong / untrusted async blogs in MM and the infrequency of operations deviating significantly, we'd rather handwrite exceptional cases for now.

Terraform's templates only use a limited number of fields from the operations.

modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Nov 25, 2024
)

[upstream:40271bcda3afeca21b9bdb4cb7f35485e997d5b4]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit that referenced this issue Nov 25, 2024
)

[upstream:40271bcda3afeca21b9bdb4cb7f35485e997d5b4]

Signed-off-by: Modular Magician <[email protected]>
@melinath
Copy link
Collaborator Author

melinath commented Dec 6, 2024

Closing as a duplicate of #17098 - we should just remove the configuration for now and then do an actual intentional implementation later if needed.

@melinath melinath closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2024
Copy link

github-actions bot commented Jan 6, 2025

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
mmv1-generator Provider-wide changes to resource templates or other generator changes service/terraform size/m technical-debt
Projects
None yet
Development

No branches or pull requests

2 participants