mineiros-io / terraform-github-team

A Terraform module to manage GitHub Teams. https://github.com/
Apache License 2.0
53 stars 20 forks source link

How to fix breaking changes in 0.8.0? #58

Closed 0x46616c6b closed 2 years ago

0x46616c6b commented 2 years ago

Hey,

I tried to update from 0.7.0 to 0.8.0 and stumbled upon the breaking changes. Receiving this error I have no glue how to fix it.

│ Error: Cross-package move statement
│ 
│   on .terraform/modules/team/main.tf line 12, in resource "github_team" "team":
│   12:   count = var.module_enabled ? 1 : 0
│ 
│ This statement declares a move to an object declared in external module
│ package "registry.terraform.io/mineiros-io/team/github". Move statements
│ can be only within a single module package.

I use the module to iterate over a bunch of teams, like

module "team" {
  for_each = local.teams

  source  = "mineiros-io/team/github"
  version = "~> 0.7.0"

  name           = each.value.name
  description    = try(each.value.description, null)
  privacy        = try(each.value.privacy, "closed")
  parent_team_id = try(each.value.parent_team_id, null)

  # GitHub automatically add Admins as Maintainers to Teams
  maintainers = distinct(concat(sort(each.value.maintainers), sort(setintersection(each.value.members, local.admins))))
  members     = setsubtract(each.value.members, local.admins)

}

Do you have an idea how to fix that?

mariux commented 2 years ago

Hi ;)

│ This statement declares a move to an object declared in external module
│ package "registry.terraform.io/mineiros-io/team/github". Move statements
│ can be only within a single module package.

The Error states a failing moved statement. Afaics we do not have any moved blocks in the module code atm.

Is there a moved statement in your code?

This might be because of the introduction of count in the module, but normally terraform should just pick this up, what version of terraform are you using?