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

Unable to show resources with self_link in metadata #1301

Closed
joe-a-t opened this issue Jun 8, 2021 · 13 comments
Closed

Unable to show resources with self_link in metadata #1301

joe-a-t opened this issue Jun 8, 2021 · 13 comments

Comments

@joe-a-t
Copy link

joe-a-t commented Jun 8, 2021

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v0.15.3
Kubernetes provider version: v2.3.1

Affected Resource(s)

  • kubernetes_config_map
  • kubernetes_namespace
  • Almost certainly others as well

Terraform Configuration Files

resource "kubernetes_config_map" "example" {
  metadata {
    name = "my-config"
  }
}

Debug Output

Panic Output

Steps to Reproduce

  1. Create a kubernetes_config_map with v2.3.0 (or earlier) of the Kubernetes provider
  2. Run terraform state show kubernetes_config_map.example to verify it works
  3. Upgrade the Kubernetes provider to v2.3.1
  4. terraform state show kubernetes_config_map.example will no longer work with unsupported attribute "self_link" error message

Expected Behavior

The resource should have been output.

Actual Behavior

unsupported attribute "self_link" error message

Important Factoids

This also causes errors if you try to open terraform console in any affected directories.

References

It appears to stem from #1294 cc @dak1n1

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@joe-a-t joe-a-t added the bug label Jun 8, 2021
@joe-a-t
Copy link
Author

joe-a-t commented Jun 8, 2021

Unrelated but FYI I was just notified issue_triage failed with

Error: Unable to resolve action `github/issue-labeler@v2`, unable to find version `v2`

@jrhouston
Copy link
Collaborator

Looks like we need a StateUpgrader to delete the self_link attribute from state for it to work with the terraform state command. I was able to reproduce and this doesn't seem to be affecting plan or apply.

A workaround here is run terraform refresh which will fix the state.

@dak1n1
Copy link
Contributor

dak1n1 commented Jun 9, 2021

Unrelated but FYI I was just notified issue_triage failed with

Error: Unable to resolve action `github/issue-labeler@v2`, unable to find version `v2`

Thanks for letting us know! I added some fixes to my Github Workflow PR that's in progress here: #1300

@jeunii
Copy link

jeunii commented Nov 8, 2021

✗ tfp
╷
│ Error: Unsupported attribute
│
│   on ../../modules/cluster_vault/kms.tf line 17, in resource "google_kms_crypto_key" "vault_init":
│   17:   key_ring        = google_kms_key_ring.vault.self_link
│
│ This object has no argument, nested block, or exported attribute named "self_link".

Ive already tried tf refresh but no use.

Any idea how I can fix this ?

tf version
Terraform v1.0.10
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v4.0.0
+ provider registry.terraform.io/hashicorp/google-beta v4.0.0

@jeunii
Copy link

jeunii commented Nov 8, 2021

Ok so i got hold of https://github.com/hashicorp/terraform-provider-google/pull/10424/files !

Found the fix. Replaced self_link with id in the code

@MeNsaaH
Copy link

MeNsaaH commented Mar 24, 2022

Any solution for this? I'm getting this error after upgrading from 2.0.0 to 2.78:

| Error decoding "module.az-devops-namespace_setup.kubernetes_secret.pull_secret[0]" from previous state:
│ unsupported attribute "self_link"

@tobamaestro
Copy link

@MeNsaaH similar issue here, version 2.11.0. Were you able to resolve it?

@MeNsaaH
Copy link

MeNsaaH commented Jun 6, 2022

@tobamaestro no. I had to downgrade

@tobamaestro
Copy link

@MeNsaaH Thanks for quick reply! Did you try running terraform refresh maybe before downgrading?

@MeNsaaH
Copy link

MeNsaaH commented Jun 6, 2022

@tobamaestro I'm not sure I did. I think I deleted my lock file, ran init then destroyed

@mbyio
Copy link

mbyio commented Sep 7, 2022

I encountered this issue, refreshing didn't help. I resolved it using terraform state rm to delete the offending resources, and then I re-imported them. Because I imported them using the latest Kubernetes provider version, it fixed the bad attributes.

@abdullahkhawer
Copy link

Happening with me on version 2.13.0.

Terraform will perform the following actions:

  # module.nexus_admin_user_password.kubernetes_secret.user_password will be updated in-place
  ~ resource "kubernetes_secret" "user_password" {
      ~ data      = (sensitive value)
        id        = "studio-ci/nexus-admin"
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Copy link

github-actions bot commented Jan 5, 2024

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

@github-actions github-actions bot added the stale label Jan 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2024
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

8 participants