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

Docs for google_monitoring_alert_policy have incorrect import instructions #18463

Open
red8888 opened this issue Jun 17, 2024 · 1 comment
Open

Comments

@red8888
Copy link

red8888 commented Jun 17, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Any

Affected Resource(s)

Docs: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/monitoring_alert_policy#import

Terraform Configuration

NA

Debug Output

No response

Expected Behavior

No response

Actual Behavior

No response

Steps to reproduce

No response

Important Factoids

No response

References

See previously closed issue: #7693

Still a problem I just got bit by this. That issue has a PR with the doc update ^ can someone merge that?

Also, even more annoying, I can't figure out how to get the ID of a policy, how the heck do you get this info? I had to terraform a policy just so I could look at the state output and see the number.

b/348474289

@red8888 red8888 added the bug label Jun 17, 2024
@ggtisc ggtisc added service/monitoring-alerting forward/review In review; remove label to forward labels Jun 18, 2024
@ggtisc ggtisc self-assigned this Jun 20, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented Jun 20, 2024

Confirmed issue!

It is possible to import other resources, but not a google_monitoring_alert_policy with next steps:

  1. Have created a google_monitoring_alert_policy (can use this example)
  2. Have the basic code in terraform code for the imported resource:

resource "google_monitoring_alert_policy" "alert_policy" {
display_name = "alert-policy-18463"
combiner = "OR"
conditions {
display_name = "test condition"
}
}

  1. Execute the command terraform import google_monitoring_alert_policy.alert_policy {{alert-policy-18463}}

Output:
Error creating AlertPolicy: googleapi: Error 400: Field alert_policy.conditions[0].condition_case had an invalid value of "0": Condition subtype (e.g. "condition_absent","condition_threshold", etc.) is absent or unknown.

@ggtisc ggtisc removed their assignment Jun 20, 2024
@ggtisc ggtisc removed the forward/review In review; remove label to forward label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants