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

'terraform state rm' doesn't delete child module #23724

Open
max-rocket-internet opened this issue Dec 19, 2019 · 2 comments
Open

'terraform state rm' doesn't delete child module #23724

max-rocket-internet opened this issue Dec 19, 2019 · 2 comments

Comments

@max-rocket-internet
Copy link

max-rocket-internet commented Dec 19, 2019

When using the commands terraform state rm module.xxx child modules are not deleted.

Terraform Version

Terraform v0.12.18
+ provider.aws v2.42.0
+ provider.random v2.2.1

Terraform Configuration Files

My state looks like this:

$ terraform state list | grep app_stg02
module.app_stg02.data.aws_iam_policy_document.app_notification_queue
module.app_stg02.aws_sqs_queue.app_notification_queue
module.app_stg02.aws_sqs_queue_policy.app_notification_queue
module.app_stg02.module.db.aws_security_group.main
module.app_stg02.module.db.random_id.master_password
module.app_stg02.module.db.random_id.snapshot_identifier
module.app_stg02.module.db.module.rds.module.db_instance.data.aws_iam_policy_document.enhanced_monitoring
module.app_stg02.module.db.module.rds_replica.module.db_instance.data.aws_iam_policy_document.enhanced_monitoring

Expected Behavior

This command deletes all state objects, including child modules: terraform state rm module.app_stg02

Actual Behavior

There is the child module still left in the state under the old name:

$ terraform state rm module.app_stg02
Removed module.app_stg02.data.aws_iam_policy_document.courier_notification_queue
Removed module.app_stg02.aws_sqs_queue.courier_notification_queue
Removed module.app_stg02.aws_sqs_queue_policy.courier_notification_queue

$ terraform state list | grep app_stg02
module.app_stg02.module.db.aws_security_group.main
module.app_stg02.module.db.random_id.master_password
module.app_stg02.module.db.random_id.snapshot_identifier
module.app_stg02.module.db.module.rds.module.db_instance.data.aws_iam_policy_document.enhanced_monitoring
module.app_stg02.module.db.module.rds_replica.module.db_instance.data.aws_iam_policy_document.enhanced_monitoring

Steps to Reproduce

See above

@max-rocket-internet
Copy link
Author

@hashibot this is a bug

@max-rocket-internet
Copy link
Author

@apparentlymart can we change the labels?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants