DrFaust92 / terraform-provider-bitbucket

Terraform Bitbucket Cloud provider.
https://registry.terraform.io/providers/drfaust92/bitbucket
Mozilla Public License 2.0
36 stars 29 forks source link

Followup to #183: Attempting to enable the production branch_type never seems to get "fixed" #207

Closed barrywhart closed 1 month ago

barrywhart commented 1 month ago

After the fix for #183 was merged and released, I found a similar issue when production/enabled is set to true. Like the earlier issue, in this case terragrunt plan always thinks there are changes to be made.

I hope to investigate this soon, perhaps next week.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed. v1.5.6

Affected Resource(s)

bitbucket_branching_model

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "bitbucket_branching_model" "branching_model" {
  owner      = var.repo_owner
  repository = var.repo_name

  development {
    name           = var.branching_model.branching_model.development.name
    use_mainbranch = var.branching_model.branching_model.development.use_mainbranch
  }

  production {
    enabled        = var.branching_model.branching_model.production.enabled
    name           = var.branching_model.branching_model.production.name
    use_mainbranch = var.branching_model.branching_model.production.use_mainbranch. # Set to true
  }

  dynamic "branch_type" {
    for_each = var.branching_model.branching_model.branch_types
    content {
      kind    = branch_type.value.kind
      enabled = branch_type.value.enabled
      prefix  = branch_type.value.prefix
    }
  }

  depends_on = [null_resource.create_branches]
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

After running terraform apply, future runs of terraform plan should show no changes to be made.

Actual Behavior

Even after terraform apply, every subsequent run of terraform plan shows the following change to be made:

  # module.ds-cc-my-repo.module.ds-cc-bitbucket-repo.bitbucket_branching_model.branching_model will be updated in-place
  ~ resource "bitbucket_branching_model" "branching_model" {
        id         = "my-org/my-repo"
        # (2 unchanged attributes hidden)

      ~ production {
          ~ enabled               = false -> true
            # (3 unchanged attributes hidden)
        }

        # (5 unchanged blocks hidden)
    }

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

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