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
terraform {
backend "gcs" {
bucket = "terraform-states"
path = "gcp/gcp.tfstate"
project = "demo"
}
}
variable "project_name" {
default = "demo"
}
variable "primary_region" {
description = "Specifies the region the infrastructure should be created in"
type = "string"
default = "europe-west1"
}
provider "google" {
project = "${var.project_name}"
region = "${var.primary_region}"
version = "1.6"
}
resource "demo-bucket" "demo-bucket" {
force_destroy = "false"
name = "demo-bucket"
location = "EUROPE-WEST1"
}
What should have happened?
importing a GCS bucket created outside of terraform should not result in a terraform plan command wanting to try to change the force_destroy state of the bucket
Actual Behavior
After importing the GCS bucket a terraform plan command wanted to update the bucket in place because of the force_destroy state.
Downloading plugin for provider "google" (1.6.0)...
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
~/Development/repository/demo/terraform/nonprod$ terraform import google_storage_bucket.demo-bucket demo-bucket
google_storage_bucket.demo-bucket: Importing from ID "demo-bucket"...
google_storage_bucket.demo-bucket: Import complete!
Imported google_storage_bucket (ID: demo-bucket)
google_storage_bucket.demo-bucket: Refreshing state... (ID: demo-bucket)
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.
~/Development/repository/demo/terraform/nonprod$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
Please list the steps required to reproduce the issue, for example:
terraform apply
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
ghost
locked and limited conversation to collaborators
Mar 29, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform Version
Terraform v0.11.3
Affected Resource(s)
Terraform Configuration Files
What should have happened?
importing a GCS bucket created outside of terraform should not result in a terraform plan command wanting to try to change the force_destroy state of the bucket
Actual Behavior
After importing the GCS bucket a terraform plan command wanted to update the bucket in place because of the force_destroy state.
Steps to Reproduce
~/Development/repository/demo/terraform/nonprod$ terraform init
Initializing the backend...
"path": [DEPRECATED] Use the "prefix" option instead
Successfully configured the backend "gcs"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
~/Development/repository/demo/terraform/nonprod$ terraform import google_storage_bucket.demo-bucket demo-bucket
google_storage_bucket.demo-bucket: Importing from ID "demo-bucket"...
google_storage_bucket.demo-bucket: Import complete!
Imported google_storage_bucket (ID: demo-bucket)
google_storage_bucket.demo-bucket: Refreshing state... (ID: demo-bucket)
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.
~/Development/repository/demo/terraform/nonprod$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
google_storage_bucket.demo-bucket: Refreshing state... (ID: demo-bucket)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
~ google_storage_bucket.demo-bucket
force_destroy: "" => "false"
Plan: 0 to add, 1 to change, 0 to destroy.
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
Please list the steps required to reproduce the issue, for example:
terraform apply
The text was updated successfully, but these errors were encountered: