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

[BUG]: github_repository_environment - no terraform diff when resetting deployment branch policies via GitHub UI #1955

Closed
1 task done
scott-doyland-burrows opened this issue Oct 12, 2023 · 0 comments · Fixed by #1981
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@scott-doyland-burrows
Copy link
Contributor

scott-doyland-burrows commented Oct 12, 2023

Expected Behavior

I set my code as follows and apply - this works.

resource "github_repository_environment" "example" {
  environment  = "example"
  repository   = "test"

  deployment_branch_policy {
    protected_branches     = true
    custom_branch_policies = false
  }
}

If I update the deployment branch policy in GitHub UI to no restriction, then re-apply I expect terraform to show a diff and reset the deployment branch policy to that of the terraform code.

Actual Behavior

Terraform does not reset the deployment branch policy.

Instead it reports no diff.

The statefile still shows the deployment branch policy as "protected_branches": true

The same scenario occurs with the custom_branch_policies

Looks like there is various bad logic in this resource with regards to the deployment branch policies.

Terraform Version

Terraform v1.6.0
on linux_amd64

  • provider registry.terraform.io/integrations/github v5.39.0

Affected Resource(s)

github_repository_environment

Terraform Configuration Files

resource "github_repository_environment" "example" {
  environment  = "example"
  repository   = "test"

  deployment_branch_policy {
    protected_branches     = true
    custom_branch_policies = false
  }
}

Steps to Reproduce

terraform apply

Reset policy as shown in GitHub UI:

image

terraform apply and there will be no diff shown.
State file still shows "protected_branches": true

Debug Output

No response

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@scott-doyland-burrows scott-doyland-burrows added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Oct 12, 2023
@kfcampbell kfcampbell moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Oct 16, 2023
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Oct 16, 2023
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
2 participants