terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG]: creating github_repository_environment_deployment_policy results in a 404 error

Open madelaney opened this issue 8 months ago • 1 comments

Expected Behavior

After creating github_repository_environment resources, I would expect that I can then successfully create github_repository_environment_deployment_policy resources.

Actual Behavior

After creating github_repository_environment resources, attempting to create github_repository_environment_deployment_policy resources results in a 404 error.

Terraform Version

Terraform v1.11.3 on darwin_arm64

  • provider registry.terraform.io/integrations/github v6.6.0

Affected Resource(s)

  • github_repository_environment_deployment_policy

Terraform Configuration Files

locals {
  environments = {
    "production" = {
      branch_pattern = "main"
    },
    "staging" = {
      branch_pattern = "develop"
    }
  ]
}

resource "github_repository_environment_deployment_policy" "deployments" {
  for_each       = local.environments
  repository     = "sample-repository"
  environment    = each.key
  branch_pattern = each.value["branch_pattern"]
}

Steps to Reproduce

terraform apply

Debug Output

module.devops_infra.github_repository_environment_deployment_policy.deployments["production"]: Creating...
2025-03-28T12:02:09.579-0400 [INFO]  Starting apply for module.devops_infra.github_repository_environment_deployment_policy.deployments["production"]
2025-03-28T12:02:09.579-0400 [DEBUG] module.devops_infra.github_repository_environment_deployment_policy.deployments["production"]: applying the planned Create change
2025-03-28T12:02:09.758-0400 [ERROR] provider.terraform-provider-github_v6.6.0: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_severity=ERROR tf_proto_version=5.6 tf_provider_addr=provider tf_req_id=b6be175b-8f88-93a9-2d30-5849074dd01f diagnostic_detail="" diagnostic_summary="POST https://api.github.com/repos/xxxxxxx/devops-infra/environments/production/deployment-branch-policies: 404 Not Found []" tf_resource_type=github_repository_environment_deployment_policy tf_rpc=ApplyResourceChange timestamp=2025-03-28T12:02:09.758-0400
2025-03-28T12:02:09.759-0400 [DEBUG] State storage *remote.State declined to persist a state snapshot
2025-03-28T12:02:09.759-0400 [ERROR] vertex "module.devops_infra.github_repository_environment_deployment_policy.deployments[\"production\"]" error: POST https://api.github.com/repos/xxxxxxx/devops-infra/environments/production/deployment-branch-policies: 404 Not Found []
2025-03-28T12:02:09.759-0400 [DEBUG] states/remote: state read serial is: 23; serial is: 23
2025-03-28T12:02:09.759-0400 [DEBUG] states/remote: state read lineage is: b3c5e710-32ab-16b0-a4b5-7536b211efc9; lineage is: b3c5e710-32ab-16b0-a4b5-7536b211efc9
2025-03-28T12:02:09.762-0400 [DEBUG] POST https://
╷
│ Error: POST https://api.github.com/repos/xxxxxxx/devops-infra/environments/production/deployment-branch-policies: 404 Not Found []
│
│   with module.devops_infra.github_repository_environment_deployment_policy.deployments["production"],
│   on module/repo/main.tf line 93, in resource "github_repository_environment_deployment_policy" "deployments":
│   93: resource "github_repository_environment_deployment_policy" "deployments" {
│
╵
2025-03-28T12:02:09.941-0400 [DEBUG] DELETE https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2025-03-28T12:02:10.012-0400 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-03-28T12:02:10.013-0400 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/integrations/github/6.6.0/darwin_arm64/terraform-provider-github_v6.6.0 id=89426
2025-03-28T12:02:10.013-0400 [DEBUG] provider: plugin exited

Panic Output

│ Error: POST https://api.github.com/repos/xxxxxxxx/devops-infra/environments/production/deployment-branch-policies: 404 Not Found []
│
│   with module.devops_infra.github_repository_environment_deployment_policy.deployments["production"],
│   on module/repo/main.tf line 93, in resource "github_repository_environment_deployment_policy" "deployments":
│   93: resource "github_repository_environment_deployment_policy" "deployments" {
│
╵

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

madelaney avatar Mar 28 '25 16:03 madelaney