# Summary creates the projects within the KelaHealth organization in terraform cloud using the [Terraform Enterprise Provider](https://www.terraform.io/docs/providers/tfe/index.html) ## STATUS ON HOLD. need workspace IDs to import existing workspaces. can't get from API because API access requires a bronze account. @camilosantana is looking into pricing UPDATE: workspace id is available in settings. back online! w00t! ### API access API endpoint doesn't seem accessible to free accounts. this section is for academic purposes. [API docs](https://www.terraform.io/docs/cloud/api/index.html) example: ```bash TOKEN=$(jq --raw-output '.credentials["app.terraform.io"].token' ~/.terraform.d/credentials.tfrc.json) curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ "https://app.terraform.io/api/v2/admin/workspaces/:id" ``` ref: [terraform-pricing](https://www.hashicorp.com/products/terraform/pricing/) ## file structure - `project-terraform.tf` - terraform backend config - `main.tf` - any shared resources - `<project.tf>` - resources related to project that correlates to filename ## contribution guide - cut branch related to Jira ticket - create a `<project>.tf` file - populate resources in above file - plan/apply accordingly ### terraform plan/apply local authentication - `terraform login` - creates needed files in `~/.terraform.d` - token is stored in plaintext at `~/.terraform.d/credentials.tfrc.json` - token is referenced by the cli via [cli-config](https://www.terraform.io/docs/commands/cli-config.html#credentials-1) terraform plan/apply will use the above auth info and the configuration defined in backend config ## VCS Provider connection to github was added manually. this is a TODO item to get it in code. []@myorukoglu - review this section. we are likely obligated to IaC all this, below including - [general-instructions](https://www.terraform.io/docs/cloud/vcs/github.html) - [kelahealth-setup](https://app.terraform.io/app/KelaHealth/settings/version-control/add)