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

Unable to configure GitHub Pages

Open multani opened this issue 2 years ago • 0 comments

Terraform Version

$ terraform -v
Terraform v1.2.9
on linux_amd64
+ provider registry.terraform.io/integrations/github v4.31.0

Affected Resource(s)

Please list the resources as a list, for example:

  • github_repository

Terraform Configuration Files

terraform {
  required_version = "~> 1.2"

  required_providers {
    github = {
      source  = "integrations/github"
      version = "5.0.0"
    }
  }
}

provider "github" {}

resource "github_repository" "test" {
  name = "test-tf-pages"

  pages {
    source {
      branch = "main"
      path   = "/"
    }
  }
}

Debug Output

https://gist.github.com/multani/e3e2669148f1605a6b743121caae17fe

There's one output when the pages are being added, and one output when the pages are being un-configured.

Expected Behavior

I can change the settings of the GitHub Pages for this repository.

Actual Behavior

Note that:

  • the same behavior happens at deletion, see the tf-apply-remove-pages.debug.log gist
  • it also happens with 4.31.0
  • it seems to be working as expected when the repository is created, but not when the repository configuration is changed

It fails with:

github_repository.test: Refreshing state... [id=test-tf-pages]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # github_repository.test will be updated in-place
  ~ resource "github_repository" "test" {
        id                          = "test-tf-pages"
        name                        = "test-tf-pages"
        # (29 unchanged attributes hidden)

      + pages {
          + source {
              + branch = "main"
              + path   = "/"
            }
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

github_repository.test: Modifying... [id=test-tf-pages]
╷
│ Error: PUT https://api.github.com/repos/multani/test-tf-pages/pages: 404 Not Found []
│ 
│   with github_repository.test,
│   on repo.tf line 1, in resource "github_repository" "test":
│    1: resource "github_repository" "test" {
│ 
╵

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

  • Seems to be connected to https://github.com/integrations/terraform-provider-github/issues/1198 but I'm using the new version

multani avatar Sep 15 '22 07:09 multani