Loading...
Loading...
### Terraform Version ```shell terraform -v Terraform v1.9.8 on darwin_arm64 + provider registry.terraform.io/ibm-cloud/ibm v1.71.0 + provider registry.terraform.io/sysdiglabs/sysdig v1.38.0 ``` ### Terraform Configuration Files ```terraform locals{ alerts = { "197178" = "ibm_usage_tier_changed" "197372" = "kubernetes_failed_to_pull_image" "197389" = "kubernetes_liveness_probe_failed" "197392" = "kubernetes_readiness_probe_failed" "242679" = "epa__readiness_probe_failed" "242683" = "epa__liveness_probe_failed_container_restarted" "242686" = "epa__failed_to_pull_image" "536236" = "epa__pc_pods_readiness_probe_failed" } } import { for_each = local.alerts to = sysdig_monitor_alert_v2_event.this[each.value] id = each.key } ``` ### Debug Output ```terraform terraform plan -generate-config-out=prometheus_alerts.tf ╷ │ Error: Cannot generate configuration │ │ on main.tf line 16, in import: │ 16: to = sysdig_monitor_alert_v2_event.this[each.value] │ │ The given import block is not compatible with config generation. The -generate-config-out option cannot be used with import blocks │ which use for_each, or resources which use for_each or count. ``` ### Expected Behavior I wanted to ask if this is a bug in my Terraform version or if it’s really not possible to do this. I wouldn’t want to just import them and then copy the configuration from the state file; I’d like to use the import block. ### Actual Behavior I can't import multiple resources at once with for_each and use terraform ```terraformplan -generate-config-out=prometheus_alerts.tf.``` ### Steps to Reproduce terraform init terraform plan -generate-config-out=prometheus_alerts.tf ### Additional Context _No response_ ### References _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.