Loading...
Loading...
<!-- Hi there, Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html. If your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers . --> ### Terraform Version <!--- Run `terraform -v` to show the version, and paste the result between the ``` marks below. If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed. --> ``` Terraform v0.12.21 + provider.google v3.22.0 + provider.google-beta v3.24.0 ``` ### Terraform Configuration Happens with GCS as the configured backend, but I image would happen with any of them. ### Expected Behavior <!-- What should have happened? --> `terraform import` should not persist state to the remote backend when -state/-state-out are used ### Actual Behavior <!-- What actually happened? --> `terraform import` persisted state to the remote backend ### Steps to Reproduce <!-- Please list the full steps required to reproduce the issue, for example: 1. `terraform init` 2. `terraform apply` --> 1. Download state `terraform state pull > temp.tfstate` 2. Import using local state `terraform import -state=temp.tfstate ` 3. Import without local state `terraform import ` The second import will error with `Error: Resource already managed by Terraform` due to it modifying the remote state ### Additional Context <!-- Are there anything atypical about your situation that we should know? For example: is Terraform running in a wrapper script or in a CI system? Are you passing any unusual command line options or environment variables to opt-in to non-default behavior? --> We are wanting to import without modifying the remote state so that we can do dry runs, and avoid having to lock and hit the network on each import invocation. This bug led to us importing a bunch of resources during testing that have to be manually removed from the state.
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.