I’m planning to govern a github organization with existing resources. I have my main.tf file in a respository in a repository https://github.com/adajou/terraform and a module in a separate repository https://github.com/adajou/terraform-module
How can I import an existing team called “test” into my existing state file and csv file for future governance
My team resource
resource "github_team" "teams" {
for_each = { for team in var.github_teams : team.name => team }
name = each.value.name
description = each.value.description
privacy = each.value.privacy
create_default_maintainer = true
}
My main.tf:
locals {
github_organization = csvdecode(file("data-files/organization.csv"))
github_organization_members = csvdecode(file("data-files/organization-members.csv"))
github_teams = csvdecode(file("data-files/teams.csv"))
github_team_members = {
for file in fileset("data-files/team-members", "*.csv") :
trimsuffix(file, ".csv") => csvdecode(file("data-files/team-members/${file}"))
}
github_team_repositories = {
for file in fileset("data-files/team-repos", "*.csv") :
trimsuffix(file, ".csv") => csvdecode(file("data-files/team-repos/${file}"))
}
}
module "github" {
source = "git::https://github.com/adajou/terraform-module.git"
github_organization = local.github_organization
github_organization_members = local.github_organization_members
github_teams = local.github_teams
github_team_members = local.github_team_members
github_team_repositories = local.github_team_repositories
}
and my csv:
name,description,privacy
oxygen,Life source,closed
sustainability,Providing sustainability data to all,closed
I tried with terraform import module.github.github_team.teams test but that didn’t work