How to remove a resource from Terraform state

0 votes

Hi Guys,

I have some resources in the Terraform state file. Now I want to remove one resource from the file. How can I do that?

Dec 7, 2020 in Terraform by akhtar
• 38,230 points
28,656 views

1 answer to this question.

0 votes

Hi@akhtar,

First, you need to remove the resource from the state file by running terraform state rm <resource-id>, and then you need to delete the associated configuration from your codebase. After that, you can run init, plan command and you will see no changes are required.

answered Dec 7, 2020 by MD
• 95,440 points

Related Questions In Terraform

0 votes
1 answer

How to create a folder in S3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket_object resource to create one ...READ MORE

answered Jun 11, 2020 in Terraform by MD
• 95,440 points
9,983 views
0 votes
1 answer

How to create a namespace in minikube using Terraform?

Hi@akhtar, You can use kubernetes_namespace resource. It is used ...READ MORE

answered Jun 30, 2020 in Terraform by MD
• 95,440 points
1,384 views
0 votes
1 answer

How to create a variable in Terraform?

Hi@akhtar, Terraform has an inbuilt variable keyword to ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,440 points
618 views
0 votes
1 answer

How to create a VPC in AWS using Terraform?

Hi@akhtar, You can find the script in the ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,440 points
1,093 views
0 votes
1 answer

'terraform' is not recognized as an internal or external command, operable program or batch file.

Hi@akhtar, You have to set an environment variable ...READ MORE

answered Jun 10, 2020 in Terraform by MD
• 95,440 points
27,331 views
0 votes
1 answer

How to create one key in AWS using terraform?

Hi@akhtar, You can use aws_key_pair resource n terraform. ...READ MORE

answered Jun 11, 2020 in Terraform by MD
• 95,440 points
1,346 views
0 votes
1 answer

How to import module in Terraform code?

Hi@akhtar, A module is a container for multiple resources that ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,440 points
1,848 views
0 votes
1 answer

How to create a rds snapshot from running rds instance in AWS using terraform?

Hi, I think you can use aws_db_instance resource to ...READ MORE

answered Jul 20, 2020 in Terraform by MD
• 95,440 points
2,431 views
0 votes
1 answer

How to read data from a file in Terraform?

Hi@akhtar, You can use the file function in Terraform. This file function ...READ MORE

answered Jul 27, 2020 in Terraform by MD
• 95,440 points
12,496 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP