This repository contains Terraform configurations to set up a team, generate a team token, and create a workspace in Terraform Enterprise (TFE).
main.tf- Creates the team, team token, and workspace in TFEworkspace_config/- Contains the workspace configurationmain.tf- Provider and backend configurationrandom_test.tf- Random resource testing configurationsetup.sh- Script to initialize and apply the workspace configuration
- Terraform installed locally
- Access to a Terraform Enterprise instance
- TFE API token with appropriate permissions
- A Terraform Enterprise organization named "test-org" exists
- Admin access to the "test-org" organization
- The TFE hostname is accessible from your environment
- Team Name:
test-team-custom - Organization:
test-org - Visibility:
secret
- Name:
random-test-workspace - Organization:
test-org - Auto-apply: Enabled
The team has the following permissions on the workspace:
- State Versions: Read
- Sentinel Mocks: None
- Runs: Apply
- Variables: Write
- Workspace Locking: Enabled
- Run Tasks: Enabled
-
Login to your Terraform Enterprise instance:
terraform login <TFE_HOSTNAME>
-
Apply the parent configuration to create the team and workspace:
terraform apply
-
Navigate to the workspace configuration and run the setup script:
cd workspace_config ./setup.sh
The parent configuration provides:
team_token- The API token for the teamtfe_hostname- The hostname of the TFE instanceworkspace_url- The URL to access the workspace
- The team token is marked as sensitive and should be handled securely
- The
.gitignorefile is configured to exclude sensitive information - Never commit
.tfvarsfiles or state files to version control - The team token should be rotated periodically for security
- Consider using a secrets management solution for storing the team token in production
The workspace configuration includes a test that:
- Creates random pet names
- Generates random strings
- Maps pet names to their corresponding strings
- Updates on every apply to verify functionality
- Create a new branch for your changes
- Make your changes
- Test the configuration
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.