EMD Blog

tfe Provider 사용 시 기본 “owners” 팀 관리 이슈 본문

IaC/Terraform

tfe Provider 사용 시 기본 “owners” 팀 관리 이슈

EmaDam 2022. 9. 4. 07:50

Terraform Cloud는 조직 내에서 팀을 관리 할 수가 있는데 이 Team의 경우 유료 기능이기 때문에 무료 버전은 “owners” 팀 만을 관리 할 수 있다. 하지만 tfe_team Resource를 사용해서 owners 팀을 관리하려 하면 아래와 같은 에러가 발생한다.

Error creating team owners for organization demo-vntg-organization: missing entitlements to create teams

생성 권한이 없다는 에러로 보이는데, 실제로 plan에 보면 team을 생성하긴 한다. 문제는 이 팀은 이미 존재하고 있는 상태지만 refresh로 state파일에 반영 할 수는 없기 때문에(Terraform으로 생성한 것이 아니므로) 무조건 처음에 생성해야 한다.하지만 owner팀은 이미 존재하므로 생성할 수도 없고 프리티어라 생성할 권한도 없는 상태. 일단 이 문제가 맞는 것인지 hashicorp에 문의해놓은 상태.

============

resource "tfe_team" "demo_team" {
	name = "owners"
	organization = tfe_organization.demo_organization.id 
}

위 처럼 생성 할 경우 owners 팀을 처음에 먼저 생성하려하기 때문에 생성이 안되는게 맞음. 하지만 owners 팀은 state와 매핑 자체가 안되어 있기 때문에 refresh도 안됨. 이럴 때는 datasource로 팀 id를 직접 가져와서 다른 곳에서 참조하면 됨.

It seems that you are trying to create a team named "owners", but this team already exists, as it is the default team for the organization.

You should instead use the "tfe_team" data source to get the ID of the team and use that in the rest of your code.