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 removal command does not work #1890

Closed
dumlutimuralp opened this issue Feb 21, 2024 · 5 comments · Fixed by #1894
Closed

Terraform state removal command does not work #1890

dumlutimuralp opened this issue Feb 21, 2024 · 5 comments · Fixed by #1894

Comments

@dumlutimuralp
Copy link

Description

Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/* directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply without any further changes.

If your request is for a new feature, please use the Feature request template.

  • [ x ] ✋ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Versions

  • Module version [Required]:

  • Terraform version:
    Terraform v1.7.3

  • Provider version(s):

  • provider registry.terraform.io/hashicorp/aws v5.37.0
  • provider registry.terraform.io/hashicorp/cloudinit v2.3.3
  • provider registry.terraform.io/hashicorp/helm v2.12.1
  • provider registry.terraform.io/hashicorp/kubernetes v2.26.0
  • provider registry.terraform.io/hashicorp/time v0.10.0
  • provider registry.terraform.io/hashicorp/tls v4.0.5

Steps to reproduce the behavior:

  1. Apply any of the blueprints listed in this repo.
  2. Follow the destroy section of the blueprints to remove the environment.
  3. When performing the terraform state rm 'module.eks.aws_eks_access_entry.this["cluster_creator_admin"]' || true , this state is not listed in the terraform state list output.

The actual state name is 'module.eks.aws_eks_access_entry.this["cluster_creator"]'

Expected behavior

State to be removed.

Actual behavior

Error message appears.

Terminal Output Screenshot(s)

$ terraform state rm 'module.eks.aws_eks_access_entry.this["cluster_creator_admin"]' || true
╷
│ Error: Invalid target address
│ 
│ No matching objects found. To view the available instances, use "terraform state list". Please modify the address to reference a specific instance.

Additional context

@praseedasathaye
Copy link
Contributor

cc: @bryantbiggs

@iamsouravin
Copy link
Contributor

Both the access entry and access policy states should be removed for this to work correctly.

terraform state rm 'module.eks.aws_eks_access_entry.this["cluster_creator"]'
terraform state rm 'module.eks.aws_eks_access_policy_association.this["cluster_creator_admin"]'

@praseedasathaye
Copy link
Contributor

@bryantbiggs and @askulkarni2

@bryantbiggs
Copy link
Contributor

Yes, it looks like a typo - PRs are welcomed

@praseedasathaye
Copy link
Contributor

@iamsouravin can you submit a PR for this?

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