-
Notifications
You must be signed in to change notification settings - Fork 10
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
pulumi refresh
without GH credentials deletes resources from the state.
#202
Comments
Hi @ringods - thank you for filing this. Could you clarify a few things for me:
|
Update: I had some time to look at this further and could duplicate some of this behavior with a similar setup. I believe that what you're seeing is inherited behavior from upstream as well: Your TeamMembership and Repository resources were deleted from your Stack, but not from GitHub itself, correct? |
@guineveresaenger correct. Some resources were removed from the state during Have a talk with @pierskarsenbarg. I filed a support ticket for this as well and he looked at that ticket for me. His investigation also lead to #203. |
Some more digging here, indeed appears not solvable without patching the upstream code. When performing a read it's consulting owner := meta.(*Owner).name which in the case of anonymous client is empty string "". And then it's trying to lookup a repo https://github.com//myrepo which results in 404. What it could be looking at instead is the actual owner name that's passed in:
That's just for the Repository resource though; a comprehensive fix would have to look at all resources carefully. What we also could consider doing is just enforcing that the provider is always configured, refusing to proceed without a valid GITHUB_TOKEN, we could do this at Pulumi level via PreConfigureCallback. It appears that the upstream provider is intentional about allowing an anonymous client to proceed without auth but the experience around accidental deletions is universally terrible. Are there important use cases we'd lose if the Pulumi provider forced the client to be authenticated? |
Upstream PR with a possible fix direction: integrations/terraform-provider-github#1750 |
Closing this as done since the upstream PR was accepted |
Hello!
Issue details
I am using the Github provider to manage our complete Github organization, similarly to your blog article. I started with a working Github Actions setup with
preview
on pull request andup
on merge onmain
.Following the proper CI setup, I started configuring Dependabot using the
.github/dependabot.yml
file. This creates pull requests when it finds newer package versions you are using in your setup. When Dependabot executed, it indeed created the PRs, but the Actions run linked to it failed. After some searching, here was my answer why it failed:https://github.blog/changelog/2021-11-30-github-actions-workflows-triggered-by-dependabot-receive-dependabot-secrets/
I had
refresh: true
in my Github Actions configuration. Therefresh
reported this for 2 resource types:as well as (correct) connection errors:
The error message is only clear for
BranchProtection
resources that these are authentication errors. Other resources likeMembership
andTeamRepository
return the confusingThis resource can only be used in the context of an organization
message while thegithub:owner
is properly set.Steps to reproduce
GITHUB_TOKEN
) in your setuppulumi refresh
Expected: Only see authentication errors being reported
Actual: See a mix of authentication errors and resource deletions being reported.
References:
The text was updated successfully, but these errors were encountered: