Home Software Engineering Learn how to Take away a Useful resource from Terraform State

Learn how to Take away a Useful resource from Terraform State

0
Learn how to Take away a Useful resource from Terraform State

[ad_1]

Terraform state displays the hottest reference of the infrastructure.

Typically you might have to take away a useful resource from the Terraform state manually. That is useful if a useful resource has been deleted or modified manually and the useful resource definition has been eliminated in your Terraform code. This manner you’ll be able to re-run your Terraform plan and apply with out deleting the distant infra useful resource that you simply faraway from the state.

Step 1 – Discover the useful resource you wish to delete

Operating this command will place all sources managed by Terraform in a listing type, all sources separated by line breaks.

terraform state record

Step 2 – Take away the useful resource in query

As soon as you already know the useful resource you want to take away from the state, cross it’s Terraform reference title to the rm command under:

terraform state rm <resource_name>

Instance:

terraform state rm module.kms_key.aws_kms_key.default[0]

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here