# login to tfc to provide valid credentials for ~/.terraform.d/credentials.tfrc.json
terraform login
# set your tfc org of choice as a env var ( this will be useful later)
export TF_VAR_tfc_org="<your_TF_VAR_tfc_org>"
# export the ssh_key TF_VAR to populate your key this expects default ssh usage
export TF_VAR_ssh_key="/Users/$(whoami)/.ssh/id_rsa.pub"
# run the set up script which will initiate and create the workspaces using the Terraform client
# utilises the $TF_VAR_tfc_org env var
bash ./tfc-setup.sh
Decide if you want to run remote or local? with TFC/TFE if you choose local you will need to update the workspaces "execution mode "in the settings it defaults to remote
.
- https://app.terraform.io/app/$TF_VAR_tfc_org/workspaces/1-nomad-configuration/settings/general
- https://app.terraform.io/app/$TF_VAR_tfc_org/workspaces/2-nomad-configuration/settings/general
- https://app.terraform.io/app/$TF_VAR_tfc_org/workspaces/3-nomad-example-job-deployment/settings/general
If you want to continue with remote
you will need to add your SSH key and AWS credentials to TFC take a look at this tutorial https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-multiple-variable-sets
You will find a helper in this folder in the form of some simple code based on the TFE
provider to create a varset and assign it to the workspaces. First create the workspaces as the material preceding this.
Then review the terraform manifests and *.tfvars.example
presented below.
├── tfc_variable_set.tf
├── this.auto.tfvars.example
├── variables.tf
└── providers.tf
The code provided is intended to also make use of TF_VAR_tfc_org
exported environment variable. The code will create a variable set and assign it to the workspaces required for this demo.
Due to the expectation this code is run from your local client, we are not worried about secrets in state, but you should take care not to commit your AWS secrets to version control.
No requirements.
Name | Version |
---|---|
tfe | 0.55.0 |
No modules.
Name | Type |
---|---|
tfe_organization.this | resource |
tfe_variable.this | resource |
tfe_variable_set.this | resource |
tfe_workspace.nomad-configuration | data source |
tfe_workspace.nomad-infrastructure | data source |
tfe_workspace.nomad-job-example-deployment | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_environment_sensitive_variables | (Optional) Map of sensitive variables of 'Terraform' category used in the variable set Item syntax: { AWS_ACCESS_KEY_ID = value1, AWS_SECRET_ACCESS_KEY = value2 ... } |
map(any) |
{} |
no |
environment_variables | (Optional) Map of sensitive variables of 'Terraform' category used in the variable set Item syntax: { TF_VAR_aws_default_region = value0, AWS_DEFAULT_REGION = value1, ssh_key = value2 ... } |
map(any) |
{} |
no |
tfc_org | n/a | string |
"my-org" |
no |
variables_descriptions | (Optional) A description for the variable set | string |
"" |
no |
No outputs.