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

fix(resource_github_actions_environment_secret): handle 404 on repo read #2323

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scootafew
Copy link

Before the change?

Currently when running terraform destroy execution fails if the repository containing the environment secret was deleted outside terraform. The 404 is handled when querying the secret itself, but not in the prior request to get the repository id.

module.github.github_actions_environment_secret.secrets["MY_SECRET"]: Refreshing state... [id=repo:main:MY_SECRET]
╷
│ Error: GET https://api.github.com/repos/org/repo: 404 Not Found []
│ 
│   with module.github.github_actions_environment_secret.secrets["MY_SECRET"],
│   on ../core/github/main.tf line 134, in resource "github_actions_environment_secret" "secrets":
│  134: resource "github_actions_environment_secret" "secrets" {
│ 
╵

This is similar to #2115 & #1875

After the change?

If the repository no longer exists then the github_actions_environment_secret resource will be removed from the state (if the repo no longer exists then the secret cannot either).

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

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

Successfully merging this pull request may close these issues.

2 participants