fix: tf-validate: remove cached terraform.tfstate
In 'tf-validate' job, terraform validate will try to access the remote backend when it's already configured, which happens because .terraform/ folder is cached (backend config is stored in .terraform/terraform.tfstate). However with the GCP variant currently the pipeline has no credentials in place yet at this stage and the '-backend=false' flag is not enough to prevent this from happening in this case. The problem is well documented, see https://github.com/hashicorp/terraform/issues/33726#issuecomment-1697854309 Solution: - hide the pre-configured backend setup by removing the terraform.tfstate file beforehand in the tf-validate script - setting the cache policy to pull in order to keep the file for subsequent jobs Fixex: #80
Loading