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

Constant diff on `tfe_registry_module` with v0.51.1

Open jamesmbourne opened this issue 1 year ago • 4 comments

Terraform Cloud/Enterprise version

Terraform Cloud

Terraform version

1.6.6

Terraform Configuration Files

resource "tfe_registry_module" "module" {
  vcs_repo {
    oauth_token_id     = data.tfe_oauth_client.client.oauth_token_id
    identifier         = github_repository.module.full_name
    display_identifier = github_repository.module.full_name
  }
}

Debug Output

...

Expected Behavior

No diff when resource is up-to-date

Actual Behavior

Resources were stuck in a cycle of being destroyed and created again because of a diff in the vcs_repo block.

Screenshot 2024-01-16 at 13 34 30

Additional Context

We are using tag-based publishing for modules.

I also tried using the config

resource "tfe_registry_module" "module" {
  vcs_repo {
    tags               = true
    branch             = ""
    oauth_token_id     = data.tfe_oauth_client.client.oauth_token_id
    identifier         = github_repository.module.full_name
    display_identifier = github_repository.module.full_name
  }
}

but this continued to show a diff and try to re-create the resources.

It appears this was introduced by https://github.com/hashicorp/terraform-provider-tfe/pull/1096. Downgrading to v0.50.0 resolves the issue.

jamesmbourne avatar Jan 16 '24 12:01 jamesmbourne

We are seeing the same issue for our org. Downgrading to v0.50.0 to test now.

brianpham avatar Jan 16 '24 18:01 brianpham

Downgrading to v0.50.0 works for us

brianpham avatar Jan 16 '24 18:01 brianpham

Hi @brianpham We were able to fix this by adding the organisation argument to the tfe_registry_module resource block.

As it states in the docs, if you have module_providev specified or vcs_repo is used via a GitHub App you must have the organisation argument set.

Hope this helps

LiamLogan1996 avatar Jan 25 '24 10:01 LiamLogan1996

Hi! Great to "bump" into this issue here! :)

Noticed also this changed behaviour ; I had to do two things (using the latest provider version 0.52.0):

  1. added the TFE_ORGANIZATION variable (or, set the organization in the provider config)
  2. as we use tag-based publishing, first-time ever, I had to set this in our custom module (I think it's been a default to true earlier, looks like it at least)

And, we're not (still yet) using a GitHub app for GitHub access but the "old-school" OAuth. Hmm. Interesting.

iniinikoski avatar Feb 27 '24 14:02 iniinikoski