Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error refreshing state error #176

Open
SagarDamu opened this issue Apr 27, 2022 · 3 comments
Open

Error refreshing state error #176

SagarDamu opened this issue Apr 27, 2022 · 3 comments

Comments

@SagarDamu
Copy link

SagarDamu commented Apr 27, 2022

Hi,
Currently, I'm facing an issue, they are while trying to trigger the terraform-plan a second time after a successful build in concourse getting the error refresh state error, attached the error message below for your reference

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Error refreshing state: state snapshot was created by Terraform v1.1.8, which is newer than current v0.13.5; upgrade to Terraform v1.1.8 or greater to work with this state

and also I'm having a doubt that is there any way to create a terraform workspace through concourse pipeline and in that workspace to plan, apply and destroy our change.
Thanks in advance.

@ljfranklin
Copy link
Owner

What version of the terraform-resource are you using (check resource_types.terraform.source.tag)? Sounds like you're trying to interact with an existing workspace that was created outside your CI pipeline using a newer version of Terraform but your current CI pipeline is using an older version of the terraform-resource. Updating the tag value of the terraform-resource in your pipeline config should fix it.

also I'm having a doubt that is there any way to create a terraform workspace through concourse pipeline

The terraform-resource will automatically create a workspace based on the env_name you set in your pipeline config: https://github.com/ljfranklin/terraform-resource#put-parameters.

@SagarDamu
Copy link
Author

What version of the terraform-resource are you using (check resource_types.terraform.source.tag)? Sounds like you're trying to interact with an existing workspace that was created outside your CI pipeline using a newer version of Terraform but your current CI pipeline is using an older version of the terraform-resource. Updating the tag value of the terraform-resource in your pipeline config should fix it.

Actually, no change in the version of the terraform while trying to trigger another time after the successful build without any change gave me the above-mentioned error, and also tried to change the tag version which is giving me another error

Error: Unsupported Terraform Core version

  on .terraform/modules/ci-west-prefDS/terraform/modules/dataService/main.tf line 4, in terraform:
   4:   required_version = ">= 1.1.8"

Module module.ci-west-prefDS (from
git::ssh://[email protected]/appds-tools/coast-infrastructure//terraform/modules/dataService/?ref=ICSPS-674_TEL)
does not support Terraform version 0.13.5. To proceed, either choose another
supported Terraform version or update this version constraint. Version
constraints are normally set for good reason, so updating the constraint may
lead to other errors or unexpected behavior.

@ljfranklin
Copy link
Owner

The error says does not support Terraform version 0.13.5 which sounds like your terraform-resource tag is still set to 0.13.5. The latest tag contains Terraform version v1.1.9:

$ docker pull ljfranklin/terraform-resource:latest
$ docker run -it ljfranklin/terraform-resource:latest terraform -v
Terraform v1.1.9
on linux_amd64

Double-check that your resource_types.terraform.source.tag value is set to 1.1.8 or higher. If that's correct then something about your Concourse installation is broken because it should be pulling new images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants