integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
870 stars 708 forks source link

[BUG]: `github_actions_organization_permissions` does not pick up failed plan and allows apply #2251

Open mattgrul opened 2 months ago

mattgrul commented 2 months ago

Expected Behavior

When running the github_actions_organization_permissions with a mis-configuration like the below the plan should pick up on the error.

The plan run should fail with the same reason the apply errors before the apply attempts to run.

Actual Behavior

The plan successfully runs but the subsequent apply fails.

Terraform Version

Terraform Cloud v1.8.0

Affected Resource(s)

github_actions_organization_permissions

Terraform Configuration Files

resource "github_actions_organization_permissions" "test" {
  allowed_actions = "all"
  enabled_repositories = "selected"
  allowed_actions_config {  // Incorrect, should be `enabled_repositories` and different arguments.
    github_owned_allowed = true
    patterns_allowed     = []
    verified_allowed     = false
  }
}

Steps to Reproduce

terraform plan terraform apply

Debug Output

Plan Finished

Apply Errored

Error: the enabled_repositories_config {} block must be specified if enabled_repositories == 'selected'
with github_actions_organization_permissions.test
on main.tf line 29, in resource "github_actions_organization_permissions" "test":
resource "github_actions_organization_permissions" "test" {

Panic Output

No response

Code of Conduct