Importing a google_storage_bucket resource in Terraform state fails

扶醉桌前 提交于 2020-01-25 07:24:04

问题


I'm trying to import a google_storage_bucket storage bucket in my Terraform state:

terraform import module.bf-nathan.google_storage_bucket.assets-bucket my-bucket

However, it fails as follows:

module.bf-nathan.google_storage_bucket.assets-bucket: Importing from ID "my-bucket"...
module.bf-nathan.google_storage_bucket.assets-bucket: Import complete! Imported google_storage_bucket (ID: next-assets-bf-nathan-botfront-cloud)
module.bf-nathan.google_storage_bucket.assets-bucket: Refreshing state... (ID: next-assets-bf-nathan-botfront-cloud)

Error: module.bf-nathan.provider.kubernetes: 1:11: unknown variable accessed: var.cluster_ip in:

https://${var.cluster_ip}

The refreshing step doesn't work. I ran the command from the project's root where a terraform.tfvars file exists.

I tried adding -var-file=terraform.tfvars but no luck.

Note that the variables are correctly interpolated with all other terraform commands.

It's worth noting that the bucket in question is defined in a module and not in the main.tf. Here is how the bucket is declared:

resource "google_storage_bucket" "assets-bucket" {
  name          = "${local.assets_bucket_name}"
  storage_class = "MULTI_REGIONAL"
  force_destroy = true
}
```

来源:https://stackoverflow.com/questions/59885641/importing-a-google-storage-bucket-resource-in-terraform-state-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!