Comments (4)
To confirm, have you always had it hardcoded to v2.0.0? Is there any chance you updated the Terraform version?
FWIW, it should be safe to apply that command. All the script does is install additional components (gcloud alpha
in this case) so applying it again is fine.
@bharathkkb Any ideas?
from terraform-google-gcloud.
@morgante yes i have had some other folks reach out to me via email regarding this. This seemed to be due to an upstream change in the Terraform registry/core. For example from our CI logs:
Aug 13, 2020:
Already have image (with digest): gcr.io/cloud-foundation-cicd/cft/developer-tools:0.12.0
Proceeding using application default credentials
Initializing modules...
Downloading terraform-google-modules/project-factory/google 8.1.0 for gke-project-1...
+ - gke-project-1 in .terraform/modules/gke-project-1/terraform-google-project-factory-8.1.0
Downloading terraform-google-modules/gcloud/google 1.4.1 for example.asm.asm_install...
+ - example.asm.asm_install in .terraform/modules/example.asm.asm_install/terraform-google-gcloud-1.4.1/modules/kubectl-wrapper
Aug 30, 2020
Already have image (with digest): gcr.io/cloud-foundation-cicd/cft/developer-tools:0.12.0
Proceeding using application default credentials
Initializing modules...
Downloading terraform-google-modules/project-factory/google 8.1.0 for gke-project-1...
+ - gke-project-1 in .terraform/modules/gke-project-1
Downloading terraform-google-modules/gcloud/google 1.4.1 for example.asm.asm_install...
+ - example.asm.asm_install in .terraform/modules/example.asm.asm_install/modules/kubectl-wrapper
This in turn triggered #75 so if you try to apply the change that is planned above, that will also fail due to path change.
The workaround suggested in #75 seemed to work for the other folks.
from terraform-google-gcloud.
Hi. Thanks for response.
@morgante I've always had my module version set as 2.0.0
. The only place where I use ~>
operator is:
terraform {
required_version = "~> 0.12"
required_providers {
google = "~> 3.31"
google-beta = "~> 3.31"
null = "~> 2.1"
random = "~> 2.2"
}
}
After this incident I set all versions explicitly to the following:
Terraform v0.12.29
+ provider.external v1.2.0
+ provider.google v3.31.0
+ provider.google-beta v3.31.0
+ provider.null v2.1.2
+ provider.random v2.3.0
+ provider.template v2.1.2
Seems like none of them has changed recently though.
@bharathkkb Thanks. I've already seen issue #75 but it seemed to me like the other problem caused by storing module version in a filesystem path. By the way, is it necessary to store full path in module's state? This causes issues when running Terraform from different machines, e.g. Github actions vs local (I know, it's an antipattern, but still):
~ "gcloud_bin_abs_path"
=
"/home/runner/work/myproject/.terraform/modules/backend.firestore_native_mode/terraform-google-gcloud-2.0.0/cache/694c9ae1/google-cloud-sdk/bin"
->
"/Users/mateuszgrzechocinski/myproject/.terraform/modules/backend.firestore_native_mode/terraform-google-gcloud-2.0.0/cache/694c9ae1/google-cloud-sdk/bin"
This seemed to be due to an upstream change in the Terraform registry/core
What do you mean by this? I've been running Terraform on Github Actions using the following image, where TF version is set explicitly, so I have no idea what could have changed?
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.29
I see two solutions to fix it:
- (as you advise) Try to taint all the resources
- Fix all wrong paths in my remote state so that plan would not try to change them
Either way, I'm disappointed I don't know why this happened and how to avoid it in the future.
from terraform-google-gcloud.
After spending some additional time for investigation I came to the following conclusions:
- For unknown reason, around second half of Aug 2020, Terraform changed the way
terraform init
works - Due to this change, modules used by Terraform files are stored in different location.
Before:
.terraform/modules/firestore_native_mode
└── terraform-google-gcloud-1.4.0
├── build
├── cache
├── examples
├── modules
├── scripts
└── test
After:
.terraform/modules/firestore_native_mode
├── build
├── cache
├── examples
├── modules
├── scripts
└── test
- There are modules which stores either relative or full path to itself in the Terraform state file.
terraform-google-gcloud
does so. In my case, state contains 34 occurrences ofterraform-google-gcloud-2.0.0
. One of them is:
"resources": [
{
"module": "module.backend.module.firestore_native_mode",
"mode": "data",
"type": "external",
"name": "env_override",
"provider": "provider.external",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "-",
"program": [
".terraform/modules/backend.firestore_native_mode/terraform-google-gcloud-2.0.0/scripts/check_env.sh"
],
"query": null,
"result": {
"download": ""
},
"working_dir": null
}
}
]
},
All of those resources plan
wants to change due to no. 1
4. The easiest solution to fix this was to make a little hack on state file:
# Pull remote state to local `broken.tfstate` file
$ terraform state pull > broken.tfstate
# Make a replacement
$ sed -e "s/\/terraform-google-gcloud-2.0.0//g" broken.tfstate > fixed.tfstate
# Increase serial so that Terraform will allow to use it as a new state
$ cat fixed.tfstate | grep "serial"
"serial": 12, <--- increment and save file
# Push fixed state
$ terraform state push fixed.tfstate
- After that,
terraform plan
no longer wants to change anything and generally behaves like expected.
I will keep this issue open for a couple of days so that maybe someone would explain no. 1. (unknown reason).
from terraform-google-gcloud.
Related Issues (20)
- In TF 0.13+ all list elements must have the same type HOT 3
- Add output of the gcloud command in the terraform state HOT 5
- No file diectory issue HOT 1
- Dependency Dashboard
- bin_dir is an object HOT 1
- I get local provisioner error when I try to set composer permissions using gloud on terraform HOT 1
- WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.26+; use gcloud instead. HOT 1
- Add support for OAuth access_token authentication HOT 3
- Add support for update command HOT 1
- Add a support to use Workload Identity Config File to login HOT 2
- use_connect_gateway: true drops memberships from cmd
- Adding a CMD param in the middle of arguments array breaks downstream HOT 3
- run_destroy_command is also triggered when create_cmd_triggers are used HOT 1
- Add support for using Connect Gateway with modules/kubectl-wrapper HOT 1
- Add proxy support HOT 1
- Update provider version constraint to support latest - v5.0.0
- Unable to retrieve list of available versions for hashicorp/google provider with specific constraints. HOT 5
- Cannot install gke-gcloud-auth-plugin as a component HOT 3
- Consider adding a output attribute for the return object of the gcloud cli cmd run HOT 4
- How to use module for external data resource? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-google-gcloud.