Github_team_repository resource remove manually created teams

Alert, newbie question!

I want to use the github_team_repository resource to set team permissions in repositories. Is it possible to wipe out team permissions which are not defined in a resource, without wiping out the repository? Or it this something that Terraform isn’t well suited to.

Terraform manages the resources it knows about in the code & in the state file.

To add resources into the state file you’d use terraform import for existing resources or write code and run terraform apply for new ones.

Once you set Terraform to control a resource it is important not to also manage the resource in a different way - any changes from elsewhere would be reverted if the resource is managed by Terraform, and would be ignored if the resource isn’t. So creating a new team permission outside of Terraform wouldn’t be known about, as it isn’t in the Terraform state unless you run terraform import.

The github_team_repository resource doesn’t change the repository itself, so it is safe to use without worry about destroying the repository itself.

1 Like