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

resource/gitlab_project: Fix admin token requirement to check default branch protection #1169

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

timofurrer
Copy link
Member

@timofurrer timofurrer commented Jul 11, 2022

This bugfix change set gracefully handles checking for the
instance-level default branch protection setting if the provider token
is not from an administrator user.
This bug was introduced in
#1128 in an
attempt to check the instance-level wide settings - which unfortunately,
and not to my knowledge at the time requires an admin token.

In case the token is not from an admin the project resource won't check
for the settings and by default restore the faulty behavior before #1128
which was to wait for the default branch protection to be created.
However, if this won't happen because it's disabled on the
instance-level the user can set
skip_wait_for_default_branch_protection = true which skips waiting for
the default branch protection.

Closes: #1167

@timofurrer timofurrer added this to the v3.16.1 milestone Jul 11, 2022
@timofurrer timofurrer self-assigned this Jul 11, 2022
@timofurrer timofurrer changed the title resource/gitlab_project: Fix admin token requirement to check default… resource/gitlab_project: Fix admin token requirement to check default branch protection Jul 11, 2022
RicePatrick
RicePatrick previously approved these changes Jul 11, 2022
@timofurrer timofurrer force-pushed the bugfix/1167 branch 2 times, most recently from 19a2c11 to a8cc890 Compare July 11, 2022 16:40
@timofurrer timofurrer requested a review from RicePatrick July 11, 2022 16:40
RicePatrick
RicePatrick previously approved these changes Jul 11, 2022
RicePatrick
RicePatrick previously approved these changes Jul 11, 2022
@RicePatrick
Copy link
Collaborator

Holding little bit on this before we merge it - Timo and I have an outstanding discussion on Discord around whether we need to store this value in state. We likely do, because otherwise we'll have non-empty plans on subsequent runs.

@github-actions github-actions bot added size/L and removed size/M labels Jul 11, 2022
@timofurrer timofurrer force-pushed the bugfix/1167 branch 2 times, most recently from bb825ec to 22cd624 Compare July 11, 2022 19:42
… branch protection

This bugfix change set gracefully handles checking for the
instance-level default branch protection setting if the provider token
is not from an administrator user.
This bug was introduced in
gitlabhq#1128 in an
attempt to check the instance-level wide settings - which unfortunately,
and not to my knowledge at the time requires an admin token.

In case the token is not from an admin the project resource won't check
for the settings and by default restore the faulty behavior before gitlabhq#1128
which was to wait for the default branch protection to be created.
However, if this won't happen because it's disabled on the
instance-level the user can set
`skip_wait_for_default_branch_protection = true` which skips waiting for
the default branch protection.

Closes: #1167
@timofurrer timofurrer merged commit cd90c29 into gitlabhq:main Jul 11, 2022
@github-actions
Copy link

This functionality has been released in v3.16.1 of the Terraform GitLab Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue. Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants