This repository contains Terraform code to manage HCP Terraform Cloud resources.
Before you begin, ensure you have the following:
- Terraform CLI: Install Terraform CLI (version 1.5.0 or above).
- HCP Terraform Account: Create an organization on HCP Terraform Cloud.
- Generate your user API token:
- Use the following command to generate a user token:
terraform login
- Save in a save place so you can paste it in terraform.tfvars under
tfe_tokenkey later on.
- GitHub Repository: Ensure that your GitHub repository exists and is accessible.
- GitHub OAuth Token: Generate a GitHub OAuth token for the
github_oauth_token_idvalue in the terraform.tfvars variables definition file. The token should have a repository scope.
To generate the GitHub OAuth token:- Go to your GitHub Github -> User -> Settings-> Developer Setting -> Personal Access Tokens - Fine-grained tokens.
- Save in a save place so you can paste it in terraform.tfvars under
github_oauth_token_idkey later on.
Follow these steps to set up the project:
🟣 1. Clone the Repository:
git clone https://github.com/arewezaetoime/Manage-TFC.git
cd Manage-TFC🟣 2.Create terraform file from the example file and update the variables:
cp terraform.tfvars.example terraform.tfvars- Replace the example
tfe_tokenandgithub_oauth_token_idvalues with your own tokens in the "terraform.tfvars" file and save it.
🟣 3.Run the shell script for your convenience: To simplify the process of initializing, planning, and applying resources, a shell script is provided. Run the script from the working directory as the final step.
Note: Make the script executable with the following command:
chmod +x setup_hcp_terraform.sh- Execute the script:
./setup_hcp_terraform.sh