You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.
Terraform import for google_monitoring_notification_channel should generate a valid notification channel ID that matches the imported GCP resource. In this example, it should be:
google_monitoring_notification_channel.target_project_channel: Importing from ID "projects/[project-id]/notificationChannels/1074677399646821636"...
?
¦ Error: project: required field is not set
Re-running the import succeeds with the following command:
google_monitoring_notification_channel.target_project_channel: Importing from ID "[project-id] projects/[project-id]/notificationChannels/1074677399646821636"...
google_monitoring_notification_channel.target_project_channel: Import prepared!
Prepared google_monitoring_notification_channel for import
google_monitoring_notification_channel.target_project_channel: Refreshing state... [id=[project-id] projects/[project-id]/notificationChannels/1074677399646821636]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
Running a terraform plan shows that an invalid notification channel ID has been generated for the imported resource ([project-id] projects/[project-id]/notificationChannels/1074677399646821636):
google_monitoring_notification_channel.target_project_channel: Refreshing state... [id=[project-id] projects/[project-id]/notificationChannels/1074677399646821636]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# google_billing_budget.target_project_budget will be created
+ resource "google_billing_budget" "target_project_budget" {
+ billing_account = "[billing-id]"
+ display_name = "[project-id]-testBudget"
+ id = (known after apply)
+ name = (known after apply)
+ all_updates_rule {
+ disable_default_iam_recipients = false
+ monitoring_notification_channels = [
+ "[project-id] projects/[project-id]/notificationChannels/1074677399646821636",
]
+ schema_version = "1.0"
}
+ amount {
+ specified_amount {
+ currency_code = (known after apply)
+ units = "100"
}
}
+ budget_filter {
+ credit_types = (known after apply)
+ credit_types_treatment = "INCLUDE_ALL_CREDITS"
+ labels = (known after apply)
+ projects = [
+ "projects/[project-number]",
]
+ services = (known after apply)
+ subaccounts = (known after apply)
}
+ threshold_rules {
+ spend_basis = "CURRENT_SPEND"
+ threshold_percent = 1
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Running a terraform apply fails as the channel ID is invalid:
google_billing_budget.target_project_budget: Creating...
?
¦ Error: Error creating Budget: googleapi: Error 400: Invalid notification channel name: [project-id] projects/[project-id]/notificationChannels/1074677399646821636
¦
¦ with google_billing_budget.target_project_budget,
¦ on test.tf line 28, in resource "google_billing_budget" "target_project_budget":
¦ 28: resource "google_billing_budget" "target_project_budget" {
At this stage if the state is modified with the correct notification channel ID, the apply will be successful. ie. from this:
Service account set in the GOOGLE_APPLICATION_CREDENTIALS environment variable is a different project to where the alert and notification channels are being created. The service account has sufficient permissions to create these resources in the target project.
References
The text was updated successfully, but these errors were encountered:
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.
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
1.0.4 (provider version 3.78.0)
Affected Resource(s)
Terraform Configuration Files
Note: data blocks omitted for privacy reasons
Debug Output
Panic Output
Expected Behavior
Terraform import for google_monitoring_notification_channel should generate a valid notification channel ID that matches the imported GCP resource. In this example, it should be:
Actual Behavior
Terraform import for google_monitoring_notification_channel generates an invalid notification channel ID based on the import command. In this example:
Steps to Reproduce
Note: some text replaced by [text-in-square-brackets] for privacy reasons
Output:
Output:
terraform plan
shows that an invalid notification channel ID has been generated for the imported resource ([project-id] projects/[project-id]/notificationChannels/1074677399646821636
):terraform apply
fails as the channel ID is invalid:At this stage if the state is modified with the correct notification channel ID, the apply will be successful. ie. from this:
to this (note change in the 'id' line):
Important Factoids
Service account set in the GOOGLE_APPLICATION_CREDENTIALS environment variable is a different project to where the alert and notification channels are being created. The service account has sufficient permissions to create these resources in the target project.
References
The text was updated successfully, but these errors were encountered: