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

[BUG]: Changes Reported with Identical Input and Output

Open daasol opened this issue 2 years ago • 1 comments

Expected Behavior

Hello. I don't think it's a bug, but since I'm uncertain if this is the intended result, I've categorized it as a bug and reported it.

If the input and output are not different, then it is expected behavior that no changes would be reported.

I am currently using the pages field of the github_repository resource block along with a dynamic block. Despite the input and output being completely identical in the cname field, terraform plan results show that there are changes.

Actual Behavior

terraform plan result

# module.blahblah_github_repos["repo_name"].github_repository.main[0] will be updated in-place
  ~ resource "github_repository" "main" {
        id                          = "repo_id"
        name                        = "repo_name"
      ~ topics                      = [
          + "blahblah",
            # (2 unchanged elements hidden)
        ]
        # (34 unchanged attributes hidden)

      ~ pages {
          + cname      = "https://github.blahblah.com/pages/blah/repo_name/"
            # (5 unchanged attributes hidden)

github_repository (resource block)

...
  dynamic "pages" {
    for_each = var.pages
    iterator = item
    content {
      cname = "${var.base_url}/pages/${var.blah}/${var.repo_name}/"
      source {
        branch = item.value.branch
        path   = item.value.path
      }
    }
  }

  • input : cname = "https://github.blahblah.com/pages/blah/repo_name/"
  • remote state : cname = "https://github.blahblah.com/pages/blah/repo_name/"

Additionally, the result of terraform plan is exactly the same as the cname existing in the remote state Since this issue does not occur with all dynamic blocks, I have inquired with the GitHub provider. Why is this happening?

Terraform Version

Terraform v1.1.5 on linux_amd64, macOS provider registry.terraform.io/integrations/github v5.15

Affected Resource(s)

  • github_repository (pages.cname)

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

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

daasol avatar Jan 09 '24 15:01 daasol

Hey @daasol

I think the problem may be that your cname value is not an actual cname but a url (see API docs). Try changing it to github.blahblah.com.

Cheers, Warnar

boekkooi-lengoo avatar Feb 29 '24 08:02 boekkooi-lengoo