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

feat: adding the option to disable ttl once it was enable before #111

Merged
merged 7 commits into from Mar 9, 2024

Conversation

alfredo-gil
Copy link
Contributor

what

The change aims to be able to disable the TTL once a dynamodb table was enabled before.

why

  • With the current dynamic block on the TTL option inside the aws_dynamodb_table resource if you change the var.ttl_enabled = false there are no changes on the infrastructure and the TTL is not disabled:
    No changes. Your infrastructure matches the configuration.
  • With this change you can disable the TTL on a dynamodb table that had it enabled before following this process:
  • Change the var.ttl_enabled = false Do the plan and apply
  • Change later the var.ttl_attribute="" or leave it empty to consolidate the state. If you don't do this second change your plan is going to say something like this and if you try to apply you will have an error...
 ~ resource "aws_dynamodb_table" "default" {
        id                          = "test"
        name                        = "test"
        tags                        = {
            ...
        }
        # (9 unchanged attributes hidden)

      ~ ttl {
          + attribute_name = "ttl"
            # (1 unchanged attribute hidden)
        }

        # (3 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions in workspace "test"?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.dynamodb["test"].module.dynamodb_table.aws_dynamodb_table.default[0]: Modifying... [id=test]
╷
│ Error: updating Amazon DynamoDB Table (test): updating Time To Live: ValidationException: TimeToLive is already disabled
│ 	status code: 400, request id: XXXXXXXXXXXXXXXXXXXXXX
│
│   with module.dynamodb["test"].module.dynamodb_table.aws_dynamodb_table.default[0],
│   on .terraform/modules/dynamodb.dynamodb_table/main.tf line 46, in resource "aws_dynamodb_table" "default":
│   46: resource "aws_dynamodb_table" "default" {
│

references

@alfredo-gil alfredo-gil requested review from a team as code owners April 14, 2023 10:10
@alfredo-gil
Copy link
Contributor Author

Hi @joe-niland @Gowiem, this PR is open for some months ago, Do you have any comments?
thanks in advance

@Gowiem
Copy link
Member

Gowiem commented Aug 31, 2023

/terratest

@Gowiem Gowiem added the patch A minor, backward compatible change label Sep 5, 2023
@alfredo-gil
Copy link
Contributor Author

Hi @joe-niland @Gowiem, any additional requirements to merge this PR?
Many thanks!

@hans-d hans-d enabled auto-merge (squash) March 2, 2024 11:44
@hans-d hans-d added wip Work in Progress: Not ready for final review or merge and removed wip Work in Progress: Not ready for final review or merge labels Mar 2, 2024
@hans-d
Copy link

hans-d commented Mar 3, 2024

@alfredo-gil can you update the readme (see the failing check)

@hans-d hans-d added the stale This PR has gone stale label Mar 3, 2024
@joe-niland
Copy link
Sponsor Member

@alfredo-gil and also please update your branch from master

Copy link

mergify bot commented Mar 9, 2024

Thanks @alfredo-gil for creating this pull request!

A maintainer will review your changes shortly. Please don't be discouraged if it takes a while.

While you wait, make sure to review our contributor guidelines.

Tip

Need help or want to ask for a PR review to be expedited?

Join us on Slack in the #pr-reviews channel.

@hans-d hans-d merged commit 6a38025 into cloudposse:main Mar 9, 2024
36 of 42 checks passed
@mergify mergify bot removed the stale This PR has gone stale label Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch A minor, backward compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants