Skip to content

[BUG]: Changes made to repository's Github Pages configuration outside Terraform are not detected on terraform refresh #1913

Closed as not planned

Description

@calebworks

Expected Behavior

If a github_repository resource has the pages block configured and deployed, but then the repository's Github Pages configuration is subsequently changed outside of Terraform, the Github Terraform provider should detect those changes on the next terraform plan/terraform apply/terraform refresh and update the underlying resource's configuration to what's reflected in the Terraform template.

Actual Behavior

If changes to a repository's Pages configuration are made outside Terraform those changes are not detected in the next terraform plan/terraform apply/terraform refresh and instead shows the following output:

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Terraform Version

Terraform v1.5.7
on darwin_amd64

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

Affected Resource(s)

github_repository

Terraform Configuration Files

resource "github_repository" "main" {
  name      = "test-repo"
  auto_init = true

  pages {
    source {
      branch = "master"
      path   = "/docs"
    }
  }
}

Steps to Reproduce

  1. Deploy the github_repository resource shown above, which will enable Github Pages
  2. In the Github console, change one or more of the Github Pages configuration items specified in the deployed Terraform resource
  3. Run terraform apply
  4. Observe the No changes. Your infrastructure matches the configuration output.

Debug Output

No response

Panic Output

No response

Code of Conduct

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

Activity

  1. added
    Status: Triage
    Type: Bug
    on Sep 21, 2023
  2. calebworks commented on Sep 21, 2023

    @calebworks
    Author

    Following from this bug, removing the pages config block on a github_repository resource that has already had pages disabled in the Github console (ie outside of terraform) results in a 404 upon the next terraform apply and thus a broken Terraform template/state:

    Terraform will perform the following actions:
    
      # github_repository.main will be updated in-place
      ~ resource "github_repository" "main" {
            id                          = "test-repo"
            name                        = "test-repo"
            # (34 unchanged attributes hidden)
    
          - pages {
              - build_type = "legacy" -> null
              - custom_404 = false -> null
              - html_url   = "https://redacted.pages.github.io/" -> null
              - status     = "building" -> null
              - url        = "https://api.github.com/repos/redacted/test-repo/pages" -> null
    
              - source {
                  - branch = "main" -> null
                  - path   = "/docs" -> null
                }
            }
    
            # (1 unchanged block hidden)
        }
    
    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.main: Modifying... [id=test-repo]
    
    │ Error: DELETE https://api.github.com/repos/redacted/test-repo/pages: 404 Not Found []
    │
    │   with github_repository.main,
    │   on main.tf line 1, in resource "github_repository" "main":
    │   1: resource "github_repository" "main" {
    │
    ╵
    Releasing state lock. This may take a few moments...
    

    I assume this error occurs because the resource's update method doesn't handle the 404 response.

  3. added
    Status: Up for grabs
    hacktoberfest
    on Sep 21, 2023
  4. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Sep 21, 2023
  5. removed
    Status: Triage
    on Oct 20, 2023
  6. laurenty commented on Jan 23, 2024

    @laurenty

    I'm running into the same issue regarding Terraform not detecting changes made to GitHub Pages.
    Also, I am not sure why GitHub Pages is managed as a nested block instead of being a standalone resource, they are separate endpoints in the REST API and are controlled by separate permissions.

  7. kfcampbell commented on Jan 23, 2024

    @kfcampbell
    Contributor

    They definitely should be separate resources; see #1617 for a draft attempt at splitting them. It hasn't changed yet mostly due to inertia and the severity of the breaking change.

  8. github-actions commented on Oct 20, 2024

    @github-actions

    👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

  9. added
    Status: Stale
    on Oct 20, 2024
  10. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon Oct 28, 2024
  11. ramprakashpower commented on Sep 21, 2025

    @ramprakashpower

    Hi, Any update on this. Because in our scenario we are also facing this issue like manually we did the changes on github-pages (changed folder/branch) but during the terraform plan/apply it couldn't found the drift changes between the current state with desired state. We are looking for a solution. Any of them found the solution means please update here.

  12. heclemen commented on Feb 6, 2026

    @heclemen

    we bumped into this issue after updating from 6.5.0 to 6.11.0 (tested also with 6.8 / 6.9 / 6.10)

          ~ pages {
                # (4 unchanged attributes hidden)
    
              + source {
                  + branch = "main"
                  + path   = "/"
                }
    

    doesn't get updated, always shows on the terraform plan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleStatus: Up for grabsType: Bughacktoberfest

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions