ljfranklin / terraform-resource

A concourse resource to create infrastructure via Terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plan_only failing on ashald/terraform-provider-stateful provider

mstrisoline opened this issue · comments

  • Terraform Version / Resource
bash-5.0# terraform --version
Terraform v0.13.4
+ provider registry.terraform.io/hashicorp/archive v1.3.0
+ provider registry.terraform.io/hashicorp/aws v3.8.0
+ provider registry.terraform.io/hashicorp/random v2.3.0

When running a plan_only it successfully plans but in the post step it fails. From the log it seems to be an issue with using this provider: https://github.com/ashald/terraform-provider-stateful

  • tf-plan.log
Warning: Value for undeclared variable

The root module does not declare a variable named "my_variable_name" but a
value was found in file
"/tmp/terraform-resource-out703208989/893174488vars-file.tfvars.json". To use
this value, add a "variable" block to the configuration.

Using a variables file to set an undeclared variable is deprecated and will
become an error in a future release. If you wish to provide certain "global"
settings to all configurations in your organization, use TF_VAR_...
environment variables to set these instead.


Warning: Values for undeclared variables

In addition to the other similar warnings shown, 5 other variable(s) defined
without being declared.


Warning: Interpolation-only expressions are deprecated

  on resource_plan_config.tf line 18, in output "plan_content":
  18:   value = "${stateful_string.plan_output.desired}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

(and one more similar warning elsewhere)


Error: Could not load plugin


Plugin reinitialization required. Please run "terraform init".

Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.

Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "terraform providers".

Failed to instantiate provider "registry.terraform.io/-/stateful" to obtain
schema: unknown provider "registry.terraform.io/-/stateful"

@mstrisoline thanks so much for getting the logs! This does look a bug with the resource. The resource uses a separate statefile to store the output of terraform plan in the configured backend. The stateful provider is used to do that. But if you have a plan statefile from a previous plan_only run using Terraform 0.12 or lower, looks like the resource needs to run terraform state replace-provider -auto-approve registry.terraform.io/-/stateful github.com/ashald/stateful to avoid the above error with Terraform 0.13+. I'll try to get that added to the resource in the next couple days.

To workaround this in the meantime, you could either:

  • Manually delete the "$YOUR_ENV-plan" statefile in your backend and regenerate a new plan OR
  • Manually download the "$YOUR_ENV-plan" statefile and run the above replace-provider command

Thanks for helping point me in the right direction.

Removing the plan statefile and re-running everything is working.

For anyone else that is using an s3 backend this is where that plan state can be found

s3://$BUCKET/env:/$WORKSPACE-plan/$PATH_TO_STATE/

The ljfranklin/terraform-resource:latest and ljfranklin/terraform-resource:0.13.4 images now include this fix: 1669948