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

Replace null_resource with terraform_data #1548

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

janfrederik
Copy link
Contributor

@janfrederik janfrederik commented Nov 15, 2024

As from Terraform 1.4, the doc suggests to use terraform_data instead of null_resource. See https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource.

To avoid destroy and recreation of these resources, terraform>=1.9 allows the moved statement to do exactly this refactoring. Works like a charm :-)

For details, see https://registry.terraform.io/providers/hashicorp/null/latest/docs/guides/terraform-migration#migrating-existing-configurations.

@janfrederik janfrederik marked this pull request as ready for review November 15, 2024 15:26
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.5.0"
required_version = ">= 1.9.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect OpenTofu users? Have you tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I forgot about opentofu.
OpenTofu is not on 1.9 yet, so the migration with the moved statement won't be possible. So this has to wait until opentofu catches up with v1.9.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I suggest waiting until this is compatible with OpenTofu as well, since I've switched to it over Terraform due to license changing and I expect more people using this project may have done so as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree.
I changed the status of this PR to "draft" and I subscribed to the releases of opentofu https://github.com/opentofu/opentofu/releases so I get notified when v1.9 comes out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1.9.0_beta2 doesn't contain this feature yet. I filed an issue: opentofu/opentofu#2272

@janfrederik janfrederik marked this pull request as draft November 27, 2024 15:39
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

Successfully merging this pull request may close these issues.

2 participants