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

Feature: Add flag to completely ignore checking a resource #33212

Closed
deadlydog opened this issue May 17, 2023 · 2 comments
Closed

Feature: Add flag to completely ignore checking a resource #33212

deadlydog opened this issue May 17, 2023 · 2 comments
Labels
duplicate issue closed because another issue already tracks this problem enhancement

Comments

@deadlydog
Copy link

deadlydog commented May 17, 2023

Terraform Version

❯ terraform version
Terraform v1.1.9
on windows_amd64

Your version of Terraform is out of date! The latest version
is 1.4.6. You can update by downloading from https://www.terraform.io/downloads.html

Use Cases

There are times when we have resources defined in Terraform, but we need to make manual adjustments to those resources outside of Terraform, and we want our manual changes to remain applied for a while.

  • If we ran Terraform Plan/Apply, it would pick up the differences and attempt to correct them.
  • If we removed the code from Terraform, the Plan/Apply would destroy the resources.

Neither of these are what we want. We simply want a way to still have the code defined in Terraform, with a way to signal Terraform to just completely ignore checking the resource for now.

One concrete example is when we want to turn off an Azure Virtual Machine (VM) for a while as a scream test before completely destroying it. The Azure RM Terraform provider does not provide a way to flag a VM as turned off, and if the VM is turned off, then Terraform Plan/Apply always fails because it cannot communicate with the resource.

Attempted Solutions

For the example above of turning off Azure VMs for a while before destroying them:

  • If we turn the VM off, then the Terraform Plan fails because it is not able to check the VM's state.
  • If we comment out or remove the code, then Terraform would destroy that VM.
  • If we use the prevent_destroy or ignore_changes flags, the Plan still fails because it is not able to check the CM's state.

Proposal

I would propose an ignore_checking_resource = true flag (use a different name if you like) that could be added to any resource, which signals to Terraform to not bother checking the resource and just assume it matches what it has in the state file. Even if the resource is deleted and does not exist, Terraform would not warn or error about it.

It would make sense to add this new attribute as part of the resource syntax, rather than a command-line parameter, as many Terraform flows are done via automated pipelines. It could also be included as a command-line parameter, but our main use case would be to have it in code.

References

I think this request is related to issues #23547, #3874, and #2253, but is different enough that it might not make sense to lump it in with them as a duplicate. I'll leave that decision to you fine folks.

@deadlydog deadlydog added enhancement new new issue not yet triaged labels May 17, 2023
@jbardin
Copy link
Member

jbardin commented May 17, 2023

Hi @deadlydog,

Thanks for the extra information. I assume what you mean here by "resource checking" is the refresh, or ReadResource call. If that's the case we can track the request in issue #32403

Thanks!

@jbardin jbardin closed this as completed May 17, 2023
@crw crw added duplicate issue closed because another issue already tracks this problem and removed new new issue not yet triaged labels May 18, 2023
@github-actions
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate issue closed because another issue already tracks this problem enhancement
Projects
None yet
Development

No branches or pull requests

3 participants