-
Notifications
You must be signed in to change notification settings - Fork 762
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
Can't import github_branch_protection using repository:branch id #597
Comments
This does look related to https://github.com/terraform-providers/terraform-provider-github/pull/593. 🤔 we will likely need to update the import function to handle the more flexible behaviour of providing a node ID or a repository name. |
Raised ☝️ with the import logic fixes. Take a look and let me know if the PR looks 👌 . Tested well locally but am seeing some flakiness with the acceptance tests. Aiming to get this released alongside a couple of other fixes in the upcoming |
I think there's another issue with https://github.com/terraform-providers/terraform-provider-github/pull/593 when trying to apply branch_protection_rules where
When I switch Creating branch_protection_rules in 3.1.0 with |
@kchristensen see this branch which creates a branch protection rule in |
We encountered an issue today on this, and our repo name was base64 decoeable, so it tricked the code to use the Maybe consider checking of the decoded output is valid ascii. NOTE: we've updated to We then tried importing using |
Same here, the names
Version |
I went ahead and gave the above bug a shot here: #684 Working on verifying that it works locally |
Just to update, this appears to still fail for me:
|
The failure was due to It appears this issue (and #671) are failing for me due to not checking if the imported resource exists on Github (which would be a nice check for those of us using Terraform to manage Github when we don't have direct Admin access)
|
That call out is very much appreciated. Will have to factor this angle into how the project grows over time. As for next steps to correct this behaviour, adding better error handling when branch protection does not exist makes sense. |
Hello! I am still encountering this issue in v4.26.1 when the branch protection does not exist (but the branch does exist):
with:
what can I do to overcome this error? Thank you. Best, |
👋 Hey Friends, this issue has been automatically marked as |
Updated TFC version to 1.4.6, removed integration/github version pin to 5.16, tf init -upgrade Ran into integrations/terraform-provider-github#597 importing already created release-5.1 branch with `tf import 'module.tyk.github_branch.release_branches["release-5.1"]' tyk:release-5.1` Added .terraformignore file Fixed config.yaml to reflect reality --------- Co-authored-by: Gromit <policy@gromit> Co-authored-by: Alok G Singh <[email protected]>
Terraform Version
v4.0.0
Affected Resource(s)
github_branch_protection
Terraform Configuration Files
Debug Output
https://gist.github.com/k24dizzle/db8134b8b00171f7b6dbd4c38d4886b4
I tried importing the branch protection, but the provider couldn't find the resource. But when I applied the changes, I ran into errors saying the branch protection rule for that branch already existed.
Expected Behavior
I expected terraform to import the state of the branch_protection of my
main
branch in this repo: https://github.com/kzhaotest/test as described in the documentation here: https://www.terraform.io/docs/providers/github/r/branch_protection.html#importActual Behavior
Steps to Reproduce
terraform init
terraform import github_branch_protection.test test:main
Notes
I did notice in other experiments that I was able to import a
github_branch_protection
resource by instead of usingrepo_name:branch_name
using thegraphql node id
of the branch protection rule.But I assume that this overall issue is related to https://github.com/terraform-providers/terraform-provider-github/pull/593
Interestingly enough, even though https://github.com/kzhaotest/test has a branch protection rule for the
main
branch, I wasn't able to get the id of the rule in the graphql explorer, so I wasn't able to test this assumption out here.The text was updated successfully, but these errors were encountered: