Skip to content

S3 dynamo state locking deprecated #3834

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

Open
1 task
chrisdrobison opened this issue Mar 7, 2025 · 5 comments
Open
1 task

S3 dynamo state locking deprecated #3834

chrisdrobison opened this issue Mar 7, 2025 · 5 comments
Labels
bug Something isn't working new Un-triaged issue

Comments

@chrisdrobison
Copy link

chrisdrobison commented Mar 7, 2025

Expected Behavior

Add support for using the new S3 locking state capability. This is documented here:

https://developer.hashicorp.com/terraform/language/backend/s3

Actual Behavior

Receiving the following warning when deploying using S3 and an associated DynamoDB locking state table:

│ Warning: Deprecated Parameter
│ 
│   with data.terraform_remote_state.cross-stack-reference-input-infra-services,
│   on cdk.tf.json line 44, in data.terraform_remote_state.cross-stack-reference-input-infra-services:
│   44:       }
│ 
│ The parameter "dynamodb_table" is deprecated. Use parameter "use_lockfile"
│ instead.
│ 
│ (and 2 more similar warnings elsewhere)
╵

There doesn't appear to be support for setting this new property in CDKTF.

Steps to Reproduce

  1. Configure a stack to use an S3 backend with a DynamoDB table for locking state

Versions

language: typescript
cdktf-cli: 0.20.11
node: v20.10.0
cdktf: 0.20.11
constructs: 10.4.2
jsii: null
terraform: 1.10.5
arch: arm64
os: darwin 24.3.0

Providers

┌───────────────┬──────────────────┬─────────┬────────────┬────────────────────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │
├───────────────┼──────────────────┼─────────┼────────────┼────────────────────────────┼─────────────────┤
│ aws │ 5.90.0 │ ^0.20.0 │ │ @cdktf/provider-aws │ 19.56.0 │
├───────────────┼──────────────────┼─────────┼────────────┼────────────────────────────┼─────────────────┤
│ helm │ 2.17.0 │ ^0.20.0 │ │ @cdktf/provider-helm │ 10.5.0 │
├───────────────┼──────────────────┼─────────┼────────────┼────────────────────────────┼─────────────────┤
│ kubernetes │ 2.36.0 │ ^0.20.0 │ │ @cdktf/provider-kubernetes │ 11.11.0 │
└───────────────┴──────────────────┴─────────┴────────────┴────────────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@chrisdrobison chrisdrobison added bug Something isn't working new Un-triaged issue labels Mar 7, 2025
@stekern
Copy link

stekern commented Mar 11, 2025

You should be able to temporarily use an escape hatch as a workaround at least:

      new S3Backend(this, {
        bucket: "my-bucket",
        key: "my-state.tfstate",
        region: "us-east-1"
      }).addOverride("use_lockfile", true)

@fbartho
Copy link

fbartho commented Apr 1, 2025

Thanks @stekern!

@saurabh2590
Copy link

@stekern : We tried to use suggested solution but we get the following error:


           │ Error: Extraneous JSON object property
           │ 
           │   on cdk.tf.json line 1143, in terraform.backend.s3:
           │ 1143:         "use_lockfile": true
           │ 
           │ No argument or block type is named "use_lockfile".
           ╵

This our example code:

new S3Backend(this, {
      key: `k8s-cluster`,
      bucket,
      region,
    }).addOverride("use_lockfile", true);

@stekern
Copy link

stekern commented Apr 10, 2025

@saurabh2590 Hmm. That seems to be an error from Terraform, not CDK for Terraform. Are you sure you are using a version of the Terraform binary >= v1.11.0 (where the use_lockfile argument was introduced)?

@saurabh2590
Copy link

@stekern thanks for your feedback. Updating the terraform binary resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new Un-triaged issue
Projects
None yet
Development

No branches or pull requests

4 participants