### Complete Authentication and Setup Example Source: https://developer.hashicorp.com/terraform/tutorials/0-13/aws-hcp-terraform Finalize the login process and optionally clone the getting started repository. ```bash Enter a value: Retrieved token for user YOU --------------------------------------------------------------------------------- - ----- - --------- -- --------- - ----- --------- ------ ------- ------- --------- ---------- ---- ---------- ---------- -- ---------- ---------- Welcome to HCP Terraform! - ---------- ------- --- ----- --- Documentation: terraform.io/docs/cloud -------- - ---------- ---------- --------- ----- - New to HCP Terraform? Follow these steps to instantly apply an example configuration: $ git clone https://github.com/hashicorp/tfc-getting-started.git $ cd tfc-getting-started $ scripts/setup.sh ``` ```bash Enter a value: Retrieved token for user YOU --------------------------------------------------------------------------------- - ----- - --------- -- --------- - ----- --------- ------ ------- ------- --------- ---------- ---- ---------- ---------- -- ---------- ---------- Welcome to HCP Terraform! - ---------- ------- ``` -------------------------------- ### Setup HCP Terraform project Source: https://developer.hashicorp.com/terraform/tutorials/1-0/cloud-state-api Clone the getting started repository and execute the setup script to prepare the environment. ```bash $ git clone https://github.com/hashicorp/tfc-getting-started.git $ cd tfc-getting-started $ scripts/setup.sh ``` -------------------------------- ### Clone Example Repository Source: https://developer.hashicorp.com/terraform/tutorials/cli/refresh Clone the sample repository for this tutorial to get started. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-refresh ``` ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-refresh ``` -------------------------------- ### Clone Example Configuration Source: https://developer.hashicorp.com/terraform/tutorials/state/cloud-migrate Clone the example configuration repository to start the state migration tutorial. This configuration uses the `random` provider. ```bash $ git clone https://github.com/hashicorp-education/learn-state-migration ``` -------------------------------- ### Review Example Configuration Structure Source: https://developer.hashicorp.com/terraform/tutorials/cloud/bulk-migrate-hcp The example configuration includes directories for shared backend configuration, compute resources, storage resources, and an S3 backend setup. ```tree . ├── example │ ├── backend.config │ ├── compute │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ └── storage │ ├── main.tf │ ├── outputs.tf │ └── variables.tf └── s3 ├── main.tf ├── outputs.tf └── terraform.tf ``` -------------------------------- ### Example Environment Variable Setup Source: https://developer.hashicorp.com/terraform/tutorials/hashicorp/oidc-auth0 An example of setting environment variables for OIDC auth method configuration. ```bash $ export CLIENT_ID="zaxJLTZh3n14WqSQ7qQ9onuIVRDaZdzz"; \ export CLIENT_SECRET="t35c9NNw1aZ8haEKFJbJF0lauMOSp5UNPovUJXo8Ea2sPZAR1DszEowX-6-lg-Xr"; \ export ISSUER_URL="dev-1sdl8c0z.us.auth0.com" ``` ```bash $ export CLIENT_ID="zaxJLTZh3n14WqSQ7qQ9onuIVRDaZdzz"; \ export CLIENT_SECRET="t35c9NNw1aZ8haEKFJbJF0lauMOSp5UNPovUJXo8Ea2sPZAR1DszEowX-6-lg-Xr"; \ export ISSUER_URL="dev-1sdl8c0z.us.auth0.com" ``` -------------------------------- ### Show GitHub App installation response Source: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/github-app-installations Example JSON response for a successful show installation request. ```json { "data": { "id": "ghain-R4xmKTaxnhLFioUq", "type": "github-app-installations", "attributes": { "name": "octouser", "installation-id": 54810170, "icon-url": "https://avatars.githubusercontent.com/u/29916665?v=4", "installation-type": "User", "installation-url": "https://github.com/settings/installations/54810170" } } } ``` -------------------------------- ### Clone Terraform Example Repository Source: https://developer.hashicorp.com/terraform/tutorials/configuration-language/for-each Clone the example GitHub repository to get started with the Terraform configuration. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-for-each ``` ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-for-each ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/configuration-language/configure-providers?variants=three-cloud-providers%3Agcp Use git to download the tutorial configuration files. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-providers ``` -------------------------------- ### Clone Example Repository Source: https://developer.hashicorp.com/terraform/tutorials/modules/module-object-attributes Clone the example repository for this tutorial to get started with Terraform module object attributes. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-module-object-attributes ``` ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-module-object-attributes ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/aws/aws-asg Use these commands to download the tutorial configuration files and navigate to the project directory. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-aws-asg ``` ```bash $ cd learn-terraform-aws-asg ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/0-13/dependencies Use this command to download the tutorial's example configuration files. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-dependencies ``` -------------------------------- ### Navigate to Tutorial Directory Source: https://developer.hashicorp.com/terraform/tutorials/hashicorp/consul-terraform-sync Change into the directory that contains the complete configuration files for this tutorial. ```bash cd learn-consul-cts-intro/self-managed ``` -------------------------------- ### Terraform Enterprise Installation Status Output Source: https://developer.hashicorp.com/terraform/enterprise/replicated/install/automated/active-active Example output from 'replicatedctl app status' showing the application state during installation. Installation is complete when 'IsTransitioning' is false and 'State' is 'started'. ```json [ { "AppID": "218b78fa2bd6f0044c6a1010a51d5852", "Sequence": 504, "PatchSequence": 0, "State": "starting", "DesiredState": "started", "IsCancellable": false, "IsTransitioning": true, "LastModifiedAt": "2021-01-07T21:15:11.650385151Z" } ] ``` -------------------------------- ### Clone the tutorial repository Source: https://developer.hashicorp.com/terraform/tutorials/cloud/validation-enforcement Use this command to download the example configuration files for the tutorial. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-validation-enforcement ``` -------------------------------- ### Navigate to the configuration directory Source: https://developer.hashicorp.com/terraform/tutorials/aws/aws-assumerole Change the working directory to the example repository. ```bash $ cd ../learn-terraform-aws-assume-role-ec2 ``` -------------------------------- ### Run Online Terraform Enterprise Installer Source: https://developer.hashicorp.com/terraform/enterprise/deploy/replicated/install/interactive/installer Execute the online installer script directly from your instance's shell. Ensure your instance has internet access. The installer will guide you through the remaining setup via a web interface. ```bash curl https://install.terraform.io/ptfe/stable | sudo bash ``` -------------------------------- ### Clone and navigate to the repository Source: https://developer.hashicorp.com/terraform/tutorials/0-13/for-each Commands to download the example project and enter the directory. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-for-each ``` ```bash $ cd learn-terraform-for-each ``` -------------------------------- ### Example Application Status Output Source: https://developer.hashicorp.com/terraform/enterprise/install/automated/active-active The expected JSON output when checking the application status. Installation is complete when isTransitioning is false and State is started. ```json [ { "AppID": "218b78fa2bd6f0044c6a1010a51d5852", "Sequence": 504, "PatchSequence": 0, "State": "starting", "DesiredState": "started", "IsCancellable": false, "IsTransitioning": true, "LastModifiedAt": "2021-01-07T21:15:11.650385151Z" } ] ``` ```json [ { "AppID": "218b78fa2bd6f0044c6a1010a51d5852", "Sequence": 504, "PatchSequence": 0, "State": "starting", "DesiredState": "started", "IsCancellable": false, "IsTransitioning": true, "LastModifiedAt": "2021-01-07T21:15:11.650385151Z" } ] ``` -------------------------------- ### Clone Example Repository Source: https://developer.hashicorp.com/terraform/internals/lifecycle Clone the example Terraform configuration repository to start. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-lifecycle-management ``` ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-lifecycle-management ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/cloud/drift-and-policy Clone the tutorial repository to your local machine to begin the configuration process. ```bash $ git clone https://github.com/USER/learn-terraform-drift-and-policy ``` -------------------------------- ### Install modules with terraform get Source: https://developer.hashicorp.com/terraform/tutorials/0-13/dependencies Run this command to download and install modules defined in your configuration. ```bash $ terraform get Downloading registry.terraform.io/terraform-aws-modules/sqs/aws 3.3.0 for example_sqs_queue... - example_sqs_queue in .terraform/modules/example_sqs_queue ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/aws/eks Use this command to download the tutorial repository to your local machine. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-provision-eks-cluster ``` -------------------------------- ### Navigate to the project directory Source: https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-resource-create Change the working directory to the starting point for this tutorial. ```bash $ cd terraform-provider-hashicups/04-logging ``` -------------------------------- ### Rollback: Start and Enable Replicated Source: https://developer.hashicorp.com/terraform/enterprise/deploy/replicated-migration Start and enable the Replicated services to revert to the previous installation. ```bash $ sudo systemctl enable --now replicated replicated-ui replicated-operator ``` -------------------------------- ### Clone the example configuration Source: https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-migrate Use git to clone the repository containing the tutorial configuration. ```bash $ git clone https://github.com/hashicorp-education/learn-state-migration ``` -------------------------------- ### Enable and Start Terraform Enterprise (Docker) Source: https://developer.hashicorp.com/terraform/enterprise/deploy/replicated-migration Enable the Terraform Enterprise service to start on boot and start it immediately after migration to the Docker Compose setup. ```bash $ sudo systemctl enable --now terraform-enterprise ``` -------------------------------- ### Trim function usage examples Source: https://developer.hashicorp.com/terraform/language/functions/trim Examples demonstrating how to remove specific characters from the start and end of strings. ```hcl > trim("?!hello?!", "!?") "hello" > trim("foobar", "far") "oob" > trim(" hello! world.! ", "! ") "hello! world." ``` -------------------------------- ### Review setup.sh script Source: https://developer.hashicorp.com/terraform/tutorials/provision/packer?utm_offer=ARTICLE_PAGE The provisioning script installs dependencies, configures users, and sets up the Go web application. ```bash #!/bin/bash set -x # Install necessary dependencies sudo apt-get update -y sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade sudo apt-get update sudo apt-get -y -qq install curl wget git vim apt-transport-https ca-certificates sudo add-apt-repository ppa:longsleep/golang-backports -y sudo apt-get -y -qq install golang-go # Setup sudo to allow no-password sudo for "hashicorp" group and adding "terraform" user sudo groupadd -r hashicorp sudo useradd -m -s /bin/bash terraform sudo usermod -a -G hashicorp terraform sudo cp /etc/sudoers /etc/sudoers.orig echo "terraform ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/terraform # Installing SSH key sudo mkdir -p /home/terraform/.ssh sudo chmod 700 /home/terraform/.ssh sudo cp /tmp/tf-packer.pub /home/terraform/.ssh/authorized_keys sudo chmod 600 /home/terraform/.ssh/authorized_keys sudo chown -R terraform /home/terraform/.ssh sudo usermod --shell /bin/bash terraform # Create GOPATH for Terraform user & download the webapp from github sudo -H -i -u terraform -- env bash << EOF whoami echo ~terraform cd /home/terraform export GOROOT=/usr/lib/go export GOPATH=/home/terraform/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin git clone https://github.com/hashicorp-education/learn-go-webapp-demo EOF ``` ```bash #!/bin/bash set -x # Install necessary dependencies sudo apt-get update -y sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade sudo apt-get update sudo apt-get -y -qq install curl wget git vim apt-transport-https ca-certificates sudo add-apt-repository ppa:longsleep/golang-backports -y sudo apt-get -y -qq install golang-go ``` -------------------------------- ### Clone the Example Repository Source: https://developer.hashicorp.com/terraform/tutorials/configuration-language/checks Use Git to clone the repository containing the tutorial configuration files. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-checks ``` -------------------------------- ### Create example directory Source: https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-function-only Creates and navigates to a directory for testing the provider configuration. ```bash $ mkdir -p examples/functions/rfc3339_parse && cd "$_" ``` -------------------------------- ### List GitHub App installations response Source: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/github-app-installations Example JSON response for a successful list installations request. ```json { "data": [ { "id": "ghain-BYrbNeGQ8nAzKouu", "type": "github-app-installations", "attributes": { "name": "octouser", "installation-id": 54810170, "icon-url": "https://avatars.githubusercontent.com/u/29916665?v=4", "installation-type": "User", "installation-url": "https://github.com/settings/installations/54810170" } } ] } ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/applications/datadog-provider Download the tutorial configuration files from the HashiCorp education repository. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-datadog-local ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/aws/rds-upgrade Download the starter configuration containing the RDS instance and parameter group definitions. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-rds-upgrade ``` -------------------------------- ### Install module from public registry Source: https://developer.hashicorp.com/terraform/language/block/module Example of installing a module from the public Terraform registry. Specify the source and version. ```terraform module "consul" { source = "hashicorp/consul/aws" version = "0.1.0" } ``` -------------------------------- ### Install Local Terraform Module Source: https://developer.hashicorp.com/terraform/tutorials/modules/module-create Use `terraform get` to install modules into your configuration. For local modules, Terraform refers directly to the source directory, automatically detecting changes without needing to re-run `terraform init` or `terraform get`. ```bash $ terraform get ``` -------------------------------- ### Navigate to example directory Source: https://developer.hashicorp.com/terraform/tutorials/cloud/bulk-migrate-hcp Change the current working directory to the example folder. ```bash $ cd ../example ``` -------------------------------- ### View Terraform Enterprise Installation Status Output Source: https://developer.hashicorp.com/terraform/enterprise/deploy/replicated/install/automated/active-active This JSON output represents the status of the Terraform Enterprise application during installation. 'State' should eventually be 'started' and 'IsTransitioning' should be 'false' for a successful installation. ```json [ { "AppID": "218b78fa2bd6f0044c6a1010a51d5852", "Sequence": 504, "PatchSequence": 0, "State": "starting", "DesiredState": "started", "IsCancellable": false, "IsTransitioning": true, "LastModifiedAt": "2021-01-07T21:15:11.650385151Z" } ] ``` -------------------------------- ### Navigate to the examples directory Source: https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-logging Change the current working directory to the examples/coffees folder. ```bash $ cd examples/coffees ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/0-13/count?utm_offer=ARTICLE_PAGE Use git to clone the tutorial repository to your local machine. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-count ``` -------------------------------- ### Clone Example Repository Source: https://developer.hashicorp.com/terraform/tutorials/configuration-language/resource Clone the Learn Terraform Resources repository to get example configuration files for provisioning AWS resources. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-resources ``` -------------------------------- ### Install module from local disk Source: https://developer.hashicorp.com/terraform/language/block/module Example of installing a module from a local directory. The source path is relative to the current working directory. ```terraform module "consul" { source = "./consul" } ``` -------------------------------- ### Specify module version in registry Source: https://developer.hashicorp.com/terraform/language/modules/syntax Installs a specific version of a module from the Terraform Registry. This example installs Consul version '0.10.0' or newer. ```terraform module "consul" { source = "hashicorp/consul/aws" version = ">= 0.10.0" servers = 3 } ``` ```terraform module "consul" { source = "hashicorp/consul/aws" version = ">= 0.10.0" servers = 3 } ``` -------------------------------- ### Navigate to Examples Directory Source: https://developer.hashicorp.com/terraform/tutorials/community-providers/providers-plugin-framework-lab Change the current directory to the 'examples/coffees' directory to apply the sample configuration for the new data source. ```bash $ cd examples/coffees ``` -------------------------------- ### Install module from private HCP Terraform registry Source: https://developer.hashicorp.com/terraform/language/block/module Example of installing a module from a private registry on HCP Terraform. Specify the source and version. ```terraform module "consul" { source = "app.terraform.io/example-corp/k8s-cluster/azurerm" version = "1.1.0" } ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/configuration-language/test Clone the template repository to your local machine to begin the tutorial. ```bash $ git clone https://github.com/USER/terraform-aws-s3-website-tests ``` -------------------------------- ### Clone Example Repository Source: https://developer.hashicorp.com/terraform/tutorials/azure/azure-virtual-machine-scale-sets Clone the example repository containing Terraform configuration for Azure Virtual Machine Scale Sets. Ensure you have Git installed. ```bash $ git clone https://github.com/hashicorp-education/learn-terraform-azure-scale-sets ``` -------------------------------- ### Navigate to Example Configuration Directory Source: https://developer.hashicorp.com/terraform/tutorials/networking/multicloud-kubernetes Change into the cloned repository directory to access the example configuration files. This directory contains subdirectories for AWS EKS, Azure AKS, Consul, and the counting-service application. ```bash $ cd learn-terraform-multicloud-kubernetes ``` ```bash $ cd learn-terraform-multicloud-kubernetes ``` -------------------------------- ### GET /websites/developer_hashicorp_terraform/config Source: https://developer.hashicorp.com/terraform/enterprise/deploy/replicated/administration/license/automated-license-utilization-reporting Retrieves the current configuration settings for the Terraform installation. ```APIDOC ## GET /websites/developer_hashicorp_terraform/config ### Description Retrieves the current configuration settings for the Terraform installation. ### Method GET ### Endpoint /websites/developer_hashicorp_terraform/config ### Parameters None ### Request Example None ### Response #### Success Response (200) - **billable_rum_count_workspace_max** (integer) - Maximum workspace billable RUM on the installation. - **billable_rum_count_workspace_median** (integer) - Median workspace billable RUM on the installation. - **billable_rum_count_workspace_min** (integer) - Lowest workspace billable RUM on the installation. - **billable_rum_opt_in** (integer) - 1 if billable RUM reporting is enabled, 0 otherwise. - **bitbucket_vcs_present** (integer) - 1 if Bitbucket is configured as a VCS provider, 0 otherwise. - **continuous_validation_used_last_90_days** (integer) - 1 if continuous validation has run in the last 90 days, 0 otherwise. - **daily_api_runs** (integer) - Count of all Terraform runs associated with api daily. - **daily_cli_runs** (integer) - Count of all Terraform runs associated with cli daily. - **daily_runs** (integer) - Count of all Terraform runs daily. - **daily_vcs_runs** (integer) - Count of all Terraform runs associated with VCS daily. - **deployment_option** (integer) - No data collected. - **drift_detection_used_last_90_days** (integer) - 1 if drift detection has run in 90 days, 0 otherwise. - **gcp_provider_present** (integer) - 1 if GCP provider is in use on the installation. - **github_vcs_present** (integer) - 1 if Github is configured as a VCS provider, 0 otherwise. - **gitlab_vcs_present** (integer) - 1 if Gitlab is configured as a VCS provider, 0 otherwise. - **installation_reporting_environment_type** (integer) - The environment the TFE installation is setup in, 0 = environment type not set, 1 = prod, 2 = non-prod. - **operational_mode** (integer) - No data collected. - **org_admin_count** (integer) - Count of admin users across all organizations in the installation. - **org_count** (integer) - Count of “Organization” configured on the installation. - **private_modules_count** (integer) - Count of private modules in the private registry. - **product_usage_reporting_opt_in** (integer) - 1 if product usage reporting is opted in, 0 otherwise. - **project_count** (integer) - Count of “Project” configured on the installation. - **run_concurrency** (integer) - Run concurrency configured for the TFE installation. #### Response Example { "billable_rum_count_workspace_max": 0, "billable_rum_count_workspace_median": 0, "billable_rum_count_workspace_min": 0, "billable_rum_opt_in": 1, "bitbucket_vcs_present": 0, "continuous_validation_used_last_90_days": 0, "daily_api_runs": 0, "daily_cli_runs": 0, "daily_runs": 0, "daily_vcs_runs": 0, "deployment_option": 0, "drift_detection_used_last_90_days": 0, "gcp_provider_present": 0, "github_vcs_present": 0, "gitlab_vcs_present": 0, "installation_reporting_environment_type": 0, "operational_mode": 0, "org_admin_count": 1, "org_count": 1, "private_modules_count": 0, "product_usage_reporting_opt_in": 1, "project_count": 1, "run_concurrency": 0 } ``` -------------------------------- ### Clone the example repository Source: https://developer.hashicorp.com/terraform/tutorials/1-0/cloud-state-api Use git to clone the repository containing the example configuration. ```bash $ git clone https://github.com/hashicorp-education/learn-tfc-state-api ``` ```bash $ git clone https://github.com/hashicorp-education/learn-tfc-state-api ``` -------------------------------- ### Navigate to the Project Directory Source: https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-functions Change the current working directory to the specific tutorial folder. ```bash $ cd terraform-provider-hashicups/08-import-order ```