### List Workspaces Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-workspace/workspace-list.md Example command to list all workspaces for a specific organization ID. ```text terrakube workspace list --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` -------------------------------- ### Create a New Organization Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/azb-organization/create.md Example command to create an organization with a specified name and description. ```text terrakube organization create -n myorg -d "org description" ``` -------------------------------- ### Create a New Team Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-team/team-create.md Example command to create a team with specific permissions and organization ID. ```text terrakube team create --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb -n AZB_USER --manage-workspace=true --manage-module=true --manage-provider=true ``` -------------------------------- ### Terrakube values.yaml Configuration Example Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/kubernetes/docker-desktop.md This is a comprehensive example of the `values.yaml` file for Terrakube Helm installation. Replace placeholder values (<>) with your specific configurations for security, storage, and Dex integration. ```yaml ## Global Name name: "terrakube" ## Terrakube Security security: adminGroup: "<>" # This should be your Github team the format is OrganizationName:TeamName (Example: MyOrg:TERRAKUBE_ADMIN) patSecret: "<>" # Sample Key 32 characters z6QHX!y@Nep2QDT!53vgH43^PjRXyC3X internalSecret: "<>" # Sample Key 32 characters Kb^8cMerPNZV6hS!9!kcD*KuUPUBa^B3 dexClientId: "github" dexClientScope: "email openid profile offline_access groups" dexIssuerUri: "http://host.docker.internal/dex" # Change for your real domain ## Terraform Storage storage: # SELECT THE TYPE OF STORAGE THAT YOU WANT TO USE AND REPLACE THE VALUES #azure: # storageAccountName: "<>" # storageAccountResourceGroup: "<>" # storageAccountAccessKey: "<>" #aws: # accessKey: "<>" # secretKey: "<>" # bucketName: "<>" # region: "<>" #gcp: # projectId: "<>" # bucketName: "<>" # credentials: | # ## GCP JSON CREDENTIALS for service account with access to read/write to the storage bucket # { # "type": "service_account", # "project_id": "", # "private_key_id": "", # "private_key": "", # "client_email": "", # "client_id": "", # "auth_uri": "", # "token_uri": "", # "auth_provider_x509_cert_url": "", # "client_x509_cert_url": "" # } ## Dex dex: enabled: true version: "v2.32.0" replicaCount: "1" serviceType: "ClusterIP" resources: limits: cpu: 512m memory: 256Mi requests: cpu: 256m memory: 128Mi properties: config: issuer: http://host.docker.internal/dex storage: type: memory oauth2: responseTypes: ["code", "token", "id_token"] skipApprovalScreen: true web: allowedOrigins: ["*"] staticClients: - id: github redirectURIs: - 'http://ui.terrakube.docker.com' - 'http://localhost:10001/login' - 'http://localhost:10000/login' - '/device/callback' name: 'github' public: true connectors: - type: github id: github name: gitHub config: clientID: "<>" clientSecret: "<>" redirectURI: "http://host.docker.internal/dex/callback" loadAllGroups: true ## API properties api: enabled: true version: "2.6.0" replicaCount: "1" serviceType: "ClusterIP" properties: databaseType: "H2" ## Executor properties executor: enabled: true version: "2.6.0" replicaCount: "1" serviceType: "ClusterIP" properties: toolsRepository: "https://github.com/AzBuilder/terrakube-extensions" toolsBranch: "main" ## Registry properties registry: enabled: true version: "2.6.0" replicaCount: "1" serviceType: "ClusterIP" ## UI Properties ui: enabled: true version: "2.6.0" replicaCount: "1" serviceType: "ClusterIP" ``` -------------------------------- ### Terrakube Login Examples Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/azb-login.md Examples of authenticating with local and remote Terrakube servers using a PAT. ```bash terrakube login --api-url http://localhost:8080 --pat eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ``` ```bash terrakube login --api-url https://terrakube.example.com --pat eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ``` -------------------------------- ### Example: List All Variables for a Workspace Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-workspace/workspace-variable/variable-list.md This example demonstrates how to list all existing variables for a specific workspace by providing the organization ID and workspace ID. ```bash terrakube workspace variable list --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb -w 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Start Minikube and Enable Addons Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/minikube.md Starts a Minikube instance and enables the ingress and storage-provisioner addons. It also shows how to retrieve the Minikube IP address. ```bash minikube start minikube addons enable ingress minikube addons enable storage-provisioner minikube ip ``` -------------------------------- ### Basic Bitbucket Pipeline Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/ci-cd-integration/bitbucket.md A minimal configuration example for executing a Terrakube job in a Bitbucket pipeline. ```yaml script: - pipe: docker://azbuilder/terrakube-pipe:1.0.0 variables: TERRAKUBE_TENANT_ID: "36857254-c824-409f-96f5-d3f2de37b016" TERRAKUBE_APPLICATION_ID: "36857254-c824-409f-96f5-d3f2de37b016" TERRAKUBE_APPLICATION_SECRET: "SuperSecret" TERRAKUBE_ORGANIZATION: "terrakube" TERRAKUBE_WORKSPACE: "bitbucket" TERRAKUBE_TEMPLATE: "vulnerability-snyk" TERRAKUBE_ENDPOINT: "https://terrakube.interal/service" ``` -------------------------------- ### Advanced Bitbucket Pipeline Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/ci-cd-integration/bitbucket.md A comprehensive configuration example including optional authentication scope and debug logging. ```yaml script: - pipe: docker://azbuilder/terrakube-pipe:1.0.0 variables: LOGIN_ENDPOINT: "https://login.microsoftonline.com" TERRAKUBE_TENANT_ID: "36857254-c824-409f-96f5-d3f2de37b016" TERRAKUBE_APPLICATION_ID: "36857254-c824-409f-96f5-d3f2de37b016" TERRAKUBE_APPLICATION_SECRET: "SuperSecret" TERRAKUBE_APPLICATION_SCOPE: "api://TerrakubeApp/.default" TERRAKUBE_ORGANIZATION: "terrakube" TERRAKUBE_WORKSPACE: "bitbucket" TERRAKUBE_TEMPLATE: "vulnerability-snyk" TERRAKUBE_ENDPOINT: "https://terrakube.interal/service" DEBUG: "true" ``` -------------------------------- ### Create a New Workspace Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-workspace/workspace-create.md Example command to create a workspace with specified organization, name, source, branch, and Terraform version. ```text terrakube workspace create --organization-id 312b4415-806b-47a9-9452-b71f0753136e -n myWorkspace -s https://github.com/AzBuilder/terraform-sample-repository.git -b master -t 0.15.0 ``` -------------------------------- ### Terraform Init Output Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/cli-driven-workflow.md This is an example of the output you can expect after a successful 'terraform init' command, indicating successful initialization of the backend and providers. ```text terraform init Initializing the backend... Initializing provider plugins... - Reusing previous version of hashicorp/random from the dependency lock file - Using previously-installed hashicorp/random v3.4.3 Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary. ``` -------------------------------- ### Terraform Login Output Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/cli-driven-workflow.md Example output showing the interactive login process and successful token storage. ```text terraform login 8080-azbuilder-terrakube-po7evw1u15x.ws-us86.gitpod.io Terraform will request an API token for 8080-azbuilder-terrakube-po7evw1u15x.ws-us86.gitpod.io using OAuth. This will work only if you are able to use a web browser on this computer to complete a login process. If not, you must obtain an API token by another means and configure it in the CLI configuration manually. If login is successful, Terraform will store the token in plain text in the following file for use by subsequent commands: C:\Users\XXXXXX\AppData\Roaming\terraform.d\credentials.tfrc.json Do you want to proceed? Only 'yes' will be accepted to confirm. Enter a value: yes Terraform must now open a web browser to the login page for 8080-azbuilder-terrakube-po7evw1u15x.ws-us86.gitpod.io. If a browser does not open this automatically, open the following URL to proceed: https://5556-azbuilder-terrakube-po7evw1u15x.ws-us86.gitpod.io/dex/auth?scope=openid+profile+email+offline_access+groups&client_id=example-app&code_challenge=YYe059U9HyeMy1-RmuEzSajPJYGdcY4IkNr0pZz4LZ8&code_challenge_method=S256&redirect_uri=http%3A%2F%2Flocalhost%3A10000%2Flogin&response_type=code&state=f8b6da79-35f3-2b92-d8d8-179cda386f91 Terraform will now wait for the host to signal that login was successful. --------------------------------------------------------------------------------- Success! Terraform has obtained and saved an API token. The new API token will be used for any future Terraform command that must make authenticated requests to 8080-azbuilder-terrakube-po7evw1u15x.ws-us86.gitpod.io. ``` -------------------------------- ### Install Local CA Certificate Source: https://github.com/terrakube-io/docs/blob/main/getting-started/development/dev-container.md Command to install the local CA certificate using mkcert. ```bash mkcert -install Created a new local CA 💥 The local CA is now installed in the system trust store! ⚡️ The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊 ``` -------------------------------- ### Install Terrakube using Helm Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/minikube.md Installs Terrakube into the 'terrakube' namespace using the Helm chart from the previously added repository. ```bash helm install terrakube terrakube-repo/terrakube -n terrakube ``` -------------------------------- ### Install Terrakube via Helm Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/minikube-+-https.md Executes the Helm installation command using the previously defined values.yaml file. ```bash helm install terrakube terrakube-repo/terrakube -n terrakube --values values.yaml ``` -------------------------------- ### Install Terrakube CLI on Windows Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/install.md Use Chocolatey to install the Terrakube CLI on Windows systems. ```powershell choco install terrakube ``` -------------------------------- ### Template with Approval Step Example Source: https://context7.com/terrakube-io/docs/llms.txt Example of a Terrakube Configuration Language (TCL) template that includes a manual approval step before applying changes. ```yaml # Template with approval step flow: - type: "terraformPlan" name: "Terraform Plan" step: 100 - type: "approval" name: "Approve Deployment" step: 150 team: "TERRAKUBE_APPROVERS" - type: "terraformApply" name: "Terraform Apply" step: 200 --- ``` -------------------------------- ### Update Team Permissions Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-team/team-update.md Example command to update workspace, module, and provider permissions for a specific team. ```bash terrakube team update --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb --id 38b6635a-d38e-46f2-a95e-d00a416de4fd --manage-workspace=true --manage-module=false --manage-provider=true ``` -------------------------------- ### List All Organizations Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/azb-organization/list.md Example command to list all existing organizations. ```text terrakube organization list ``` -------------------------------- ### Install Terrakube using Helm Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/kubernetes/azure-kubernetes-service.md Add the Terrakube Helm repository, update it, and install Terrakube with a specified values file. Ensure you are in the correct namespace. ```bash helm repo add terrakube-repo https://AzBuilder.github.io/terrakube-helm-chart helm repo update helm install terrakube terrakube-repo/terrakube --values terrakube.yaml -n terrakube ``` -------------------------------- ### Start Terrakube with Docker Compose Source: https://context7.com/terrakube-io/docs/llms.txt Start the Terrakube services using Docker Compose. This command recreates containers if they already exist. ```bash # Start Terrakube docker compose up -d --force-recreate ``` -------------------------------- ### Update Module Description Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/azb-module/module-update.md Example of updating the description for a specific module using its organization ID and module ID. ```bash terrakube module update --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb --id 38b6635a-d38e-46f2-a95e-d00a416de4fd -d "new description" ``` -------------------------------- ### Install Terrakube with SQL Azure Configuration Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/database-backend/sql-azure.md Install Terrakube using Helm, applying the custom terrakube.yaml file. This command deploys Terrakube with the specified SQL Azure database settings. ```bash helm install --values terrakube.yaml terrakube terrakube-repo/terrakube -n terrakube ``` -------------------------------- ### Start OpenBao in Development Mode Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/dynamic-provider-credentials/openbao-vault.md Run the OpenBao server in development mode with a specified root token. ```bash bao server -dev -dev-root-token-id="dev-only-token" ``` -------------------------------- ### Get Terrakube CLI Help Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/getting-started.md Use the --help flag or -h shorthand to get help for the Terrakube CLI, including specific commands and subcommands. ```bash terrakube --help ``` ```bash terrakube -h ``` ```bash terrakube organization -h ``` ```bash terrakube organization create -h ``` -------------------------------- ### Deploy Terrakube Locally Source: https://github.com/terrakube-io/docs/blob/main/getting-started/docker-compose.md Clone the repository, generate SSL certificates, and start the Docker containers. ```bash git clone https://github.com/AzBuilder/terrakube.git cd terrakube/docker-compose mkcert -key-file key.pem -cert-file cert.pem platform.local "*.platform.local" CAROOT=$(mkcert -CAROOT)/rootCA.pem cp $CAROOT rootCA.pem docker compose up -d --force-recreate ``` -------------------------------- ### Install Terrakube with Helm Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/kubernetes/docker-desktop.md Command to install Terrakube using Helm, specifying the values file and release name. Ensure you have the terrakube Helm chart available. ```bash helm install --debug --values ./values.yaml terrakube ./terrakube-helm-chart/ -n terrakube ``` -------------------------------- ### Install Terrakube Executor with Helm Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/self-hosted-agents.md Use this Helm command to install the Terrakube executor component using your custom values.yaml file. This command deploys a single executor ready to accept jobs. ```bash helm install --debug --values ./your-values.yaml terrakube terrakube-repo/terrakube -n self-hosted-executor ``` -------------------------------- ### Example Policy Output Source: https://github.com/terrakube-io/docs/blob/main/user-guide/drift-detection.md The expected JSON output format generated by the plan_information.rego policy. ```json { "created": 2, "deleted": 4, "no_change": 2, "updated": 5 } ``` -------------------------------- ### List All Jobs in an Organization Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-job/job-list.md Example of how to list all existing jobs within a specific organization by providing the organization ID. ```bash terrakube job list --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` -------------------------------- ### Deploy Terrakube with custom values Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/database-backend/postgresql.md Apply the custom configuration file during the Helm installation process. ```bash helm install --values terrakube.yaml terrakube terrakube-repo/terrakube -n terrakube ``` -------------------------------- ### List teams in an organization Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-team/team-list.md Example command to list all teams for a specific organization ID. ```text terrakube team list --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` -------------------------------- ### Configure Terraform CLI Backend Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/cli-driven-workflow.md Examples for setting up Terrakube as a remote backend or cloud provider in Terraform configuration files. ```hcl terraform { backend "remote" { hostname = "terrakube-api.example.com" organization = "simple" workspaces { name = "workspace1" } } } resource "random_string" "random" { length = 16 special = true override_special = "/@£$" } ``` ```hcl terraform { cloud { organization = "simple" hostname = "terrakube-api.example.com" workspaces { name = "samplecloud" } } } resource "random_string" "random" { length = 16 special = true override_special = "/@£$" } ``` ```hcl terraform { cloud { organization = "simple" hostname = "terrakube-api.example.com" workspaces { tags = ["development", "networking"] } } } resource "random_string" "random" { length = 16 special = true override_special = "/@£$" } ``` -------------------------------- ### Set Up Terrakube Environment and Authenticate Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/getting-started.md Set environment variables for Terrakube API URL and PAT, then run 'terrakube login'. Recommended for multiple authentications or scripts. ```bash export TERRAKUBE_API_URL="http://localhost:8080" export TERRAKUBE_PAT="your-pat-token" terrakube login ``` -------------------------------- ### Initialize Project in Dev Container Source: https://github.com/terrakube-io/docs/blob/main/getting-started/development/dev-container.md Commands to clone the repository, generate certificates, and open the project in VS Code. ```bash git clone https://github.com/AzBuilder/terrakube.git cd terrakube/.devcontainer mkcert -key-file key.pem -cert-file cert.pem platform.local *.platform.local CAROOT=$(mkcert -CAROOT)/rootCA.pem cp $CAROOT rootCA.pem cd .. code . ``` -------------------------------- ### Install Terrakube CLI on macOS Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/install.md Use Homebrew to install the Terrakube CLI on macOS systems. ```bash brew install azbuilder/cli/terrakube ``` -------------------------------- ### Delete a team example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-team/team-delete.md Example command to delete a specific team using organization and team IDs. ```text terrakube team delete --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb --id 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Example: Create a New Module with Terrakube CLI Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/azb-module/create.md Demonstrates how to create a new module using the Terrakube CLI, specifying organization ID, name, description, provider, and source. ```bash terrakube module create --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb -n myModule -d "module description" -p azurerm -s https://github.com/AzBuilder/terraform-sample-repository.git ``` -------------------------------- ### Initialize OpenBao Configuration Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/dynamic-provider-credentials/openbao-vault.md Commands to set up authentication methods, secrets, and policies in OpenBao. ```bash export VAULT_ADDR='http://localhost:8200' bao login dev-only-token bao auth enable userpass bao write auth/userpass/users/terrakube password=p@ssw0rd bao auth enable approle bao write auth/approle/role/terrakube-role secret_id_ttl=10m token_ttl=20m token_max_ttl=30m bao secrets enable -path shared -version 2 kv bao kv put -mount shared kv/creds username=terrakube password=p@ssw0rd bao auth enable jwt bao write auth/jwt/config oidc_discovery_url="https://terrakube-api.platform.local" bound_issuer="https://terrakube-api.platform.local" bao policy write tfc-policy terrakube-policy.hcl bao write auth/jwt/role/tfc-role @vault-jwt-auth-role.json ``` -------------------------------- ### Update Terraform Version Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-workspace/workspace-update.md Example command to update the Terraform version for a specific workspace within an organization. ```bash terrakube workspace update --organization-id 312b4415-806b-47a9-9452-b71f0753136e --id 38b6635a-d38e-46f2-a95e-d00a416de4fd -t 0.14.0 ``` -------------------------------- ### Create a Basic 'Hello World' Action Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/actions/developing-actions/quick-start.md This JavaScript code defines a simple Terrakube action that renders a 'Quick Start' button. It uses React component syntax and assumes Ant Design components are available. ```javascript ({ context }) => { return ( ); }; ``` -------------------------------- ### Update Variable Value Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-variable/variable-update.md Example command to update the value of a specific variable using organization, workspace, and variable IDs. ```bash terrakube workspace variable update --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb -w 38b6635a-d38e-46f2-a95e-d00a416de4fd --id 38b6635a-d38e-46f2-a95e-d00a416de4fd -v "new value" ``` -------------------------------- ### Install Minio via Helm Source: https://github.com/terrakube-io/docs/blob/main/getting-started/deployment/storage-backend/minio-s3-compatible.md Deploy the Minio storage instance into the terrakube namespace using the specified configuration file. ```bash kubectl install --values minio-setup.yaml miniostorage bitnami/minio -n terrakube ``` -------------------------------- ### Initialize Terraform Workspace Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/creating-workspace-terraform-cli.md Command to initialize the backend and create the workspace in Terrakube. ```bash terraform init ``` -------------------------------- ### Create Basic Plan and Apply Job Template Source: https://context7.com/terrakube-io/docs/llms.txt Create a reusable job template using Terrakube Configuration Language (TCL). The TCL content must be base64 encoded. ```bash # Template content: # flow: # - type: "terraformPlan" # step: 100 # - type: "terraformApply" # step: 200 TEMPLATE_TCL=$(echo -n 'flow: - type: "terraformPlan" step: 100 - type: "terraformApply" step: 200' | base64) curl -X POST "https://terrakube-api.example.com/api/v1/organization/$ORG_ID/template" \ -H "Authorization: Bearer $TERRAKUBE_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d "{ \"data\": {\n \"type\": \"template\",\n \"attributes\": {\n \"name\": \"Plan-Apply\",\n \"description\": \"Standard Terraform Plan and Apply workflow\",\n \"version\": \"1.0.0\",\n \"tcl\": \"$TEMPLATE_TCL\"\n }\n }\n }" ``` -------------------------------- ### Sample Organization Data (Simple) Source: https://github.com/terrakube-io/docs/blob/main/getting-started/development/getting-started.md XML file containing sample data for a simple organization, loaded during API startup in the development environment. ```xml api/src/main/resources/db/changelog/demo-data/simple.xml ``` -------------------------------- ### Terraform Plan Remote Execution Output Example Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/cli-driven-workflow.md This example shows the output of a remote Terraform plan execution, including the plan URL, status, and the proposed infrastructure changes. ```text Running plan in the remote backend. Output will stream here. Pressing Ctrl-C will stop streaming the logs, but will not stop the plan running remotely. Preparing the remote plan... To view this run in a browser, visit: https://8080-azbuilder-terrakube-po7evw1u15x.ws-us86.gitpod.io/app/simple/workspace1/runs/1 Waiting for the plan to start... Terrakube Remote Plan Execution Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # random_string.random will be created + resource "random_string" "random" { + id = (known after apply) + length = 16 + lower = true + min_lower = 0 + min_numeric = 0 + min_special = 0 + min_upper = 0 + number = true + numeric = true + override_special = "/@£$" + result = (known after apply) + special = true + upper = true } Plan: 1 to add, 0 to change, 0 to destroy. ``` -------------------------------- ### Push state to Terrakube Source: https://github.com/terrakube-io/docs/blob/main/user-guide/migrating-to-terrakube.md Authenticate with Terrakube, initialize the backend, and push the local state file. ```bash terraform login 8080-azbuilder-terrakube-q8aleg88vlc.ws-us92.gitpod.io terraform init terraform state push tf.state ``` -------------------------------- ### Configure Terrakube Helm Chart Values Source: https://github.com/terrakube-io/docs/blob/main/getting-started/user-management/azure-active-directory.md This is a comprehensive `values.yaml` example for the Terrakube Helm chart. It includes settings for security, storage, Dex integration, API, executor, registry, and UI. Remember to replace all `<>` placeholders with your actual values. ```yaml ## Global Name name: "terrakube" ## Terrakube Security security: adminGroup: "<>" # The value should be a valida azure ad group (example: TERRAKUBE_ADMIN) patSecret: "<>" # Sample Key 32 characters z6QHX!y@Nep2QDT!53vgH43^PjRXyC3X internalSecret: "<>" # Sample Key 32 characters Kb^8cMerPNZV6hS!9!kcD*KuUPUBa^B3 dexClientId: "microsoft" dexClientScope: "email openid profile offline_access groups" ## Terraform Storage storage: azure: storageAccountName: "XXXXXXX" # <> storageAccountResourceGroup: "XXXXXXX" # <> storageAccountAccessKey: "XXXXXXX" # <> ## Dex dex: config: issuer: https://api.terrakube.azure.com/dex storage: type: memory oauth2: responseTypes: ["code", "token", "id_token"] skipApprovalScreen: true web: allowedOrigins: ['*'] staticClients: - id: microsoft redirectURIs: - 'https://ui.terrakube.azure.com' - 'http://localhost:10001/login' - 'http://localhost:10000/login' - '/device/callback' name: 'microsoft' public: true connectors: - type: microsoft id: microsoft name: microsoft config: clientID: "<>" clientSecret: "<>" redirectURI: "https://api.terrakube.azure.com/dex/callback" tenant: "<>" ## API properties api: enabled: true replicaCount: "1" serviceType: "ClusterIP" properties: databaseType: "H2" ## Executor properties executor: enabled: true replicaCount: "1" serviceType: "ClusterIP" properties: toolsRepository: "https://github.com/AzBuilder/terrakube-extensions" toolsBranch: "main" ## Registry properties registry: enabled: true replicaCount: "1" serviceType: "ClusterIP" ## UI Properties ui: enabled: true replicaCount: "1" serviceType: "ClusterIP" ``` -------------------------------- ### Call Action Proxy with GET Request Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/actions/developing-actions/action-proxy.md Use this snippet to make a GET request through the Action Proxy. Ensure 'targetUrl', 'proxyheaders', and 'workspaceId' are correctly provided. The proxy forwards headers and includes workspace validation. ```javascript ({ context }) => { const fetchData = async () => { try { const response = await axiosInstance.get(`${context.apiUrl}/proxy/v1`, { params: { targetUrl: 'https://jsonplaceholder.typicode.com/posts/1/comments', proxyheaders: JSON.stringify({ 'Content-Type': 'application/json', }), workspaceId: context.workspace.id } }); console.log(response.data); } catch (error) { console.error('Error fetching data:', error); } }; } ``` -------------------------------- ### GET /access-token/v1/teams Source: https://github.com/terrakube-io/docs/blob/main/api/methods/personal-access-token-1.md Retrieves all personal access tokens generated by the user. ```APIDOC ## GET /access-token/v1/teams ### Description Get all the personal access token generated by the user. ### Method GET ### Endpoint /access-token/v1/teams ``` -------------------------------- ### Create a New Terrakube Job Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-job/job-create.md Example of creating a new Terrakube job with 'apply' command. Ensure you provide valid organization and workspace IDs. ```bash terrakube job create --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb -w e5ad0642-f9b3-48b3-9bf4-35997febe1fb -c apply ``` -------------------------------- ### GET /workspace/variable/list Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-workspace/workspace-variable/variable-list.md Retrieves a list of variables for a specified workspace within an organization. ```APIDOC ## GET workspace variable list ### Description Lists all existing variables for a specific workspace. ### Method GET ### Endpoint terrakube workspace variable list ### Parameters #### Query Parameters - **--organization-id** (string) - Required - The unique identifier of the organization. - **--workspace-id** (string) - Required - The unique identifier of the workspace. - **--filter** (string) - Optional - Filter criteria for the variable list. ### Request Example terrakube workspace variable list --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb -w 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Run Terrakube Setup Script Source: https://github.com/terrakube-io/docs/blob/main/getting-started/development/getting-started.md Execute this bash script to configure the Gitpod development environment. Ensure you are in the /workspace/terrakube directory if re-executing. ```bash ./scripts/setupDevelopmentEnvironment.sh ``` -------------------------------- ### Terrakube Workspace Create Usage Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/terrakube-workspace/workspace-create.md Basic syntax for executing the workspace creation command. ```text terrakube workspace create [flags] ``` -------------------------------- ### Get Team by ID Source: https://github.com/terrakube-io/docs/blob/main/api/methods/teams.md Retrieves information about a specific team within an organization. ```APIDOC ## GET /organization/{organizationId}/team/{teamId} ### Description Retrieves information about a specific team within an organization. ### Method GET ### Endpoint /organization/{organizationId}/team/{teamId} ### Parameters #### Path Parameters - **organizationId** (string) - Required - The ID of the organization. - **teamId** (string) - Required - The ID of the team. ### Response #### Success Response (200) - **data** (object) - Contains the team details. - **type** (string) - Should be "team". - **attributes** (object) - Contains the team attributes. - **name** (string) - Active Directory Group name. - **manageWorkspace** (boolean) - Enable Create/Update/Delete Workspaces for a Team. - **manageModule** (boolean) - Enable Create/Update/Delete Workspaces for a Team. - **manageProvider** (boolean) - Enable Create/Update/Delete Terraform Provider for a Team. - **manageVcs** (boolean) - Enable Create/Update/Delete VCS connection for private GIT Repositories for a Team. - **manageTemplates** (boolean) - Enable Create/Update/Delete Templates for a Team. #### Response Example ```json { "data": { "type": "team", "attributes": { "name": "TERRAKUBE_TEAM", "manageWorkspace": true, "manageModule": true, "manageProvider": true, "manageVcs": true, "manageTemplates": true } } } ``` ``` -------------------------------- ### GET /organization/{organizationId}/collection/{collectionId} Source: https://github.com/terrakube-io/docs/blob/main/api/methods/collection.md Retrieves details of a specific collection. ```APIDOC ## GET /organization/{organizationId}/collection/{collectionId} ### Description Retrieves details of a specific collection. ### Method GET ### Endpoint /organization/{organizationId}/collection/{collectionId} ### Parameters #### Path Parameters - **organizationId** (string) - Required - The unique identifier of the organization. - **collectionId** (string) - Required - The unique identifier of the collection. ``` -------------------------------- ### Create Multiple Modules with Environment Variables and Shorthands Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/getting-started.md Efficiently create multiple modules by setting the organization ID as an environment variable and using shorthand and alias commands. This reduces repetitive typing. ```bash export TERRAKUBE_ORGANIZATION_ID=8a6e9998-165c-49f0-953c-d3fb0924731a terrakube mod create -n myModule -d "module description" -p azurerm -s https://github.com/AzBuilder/terraform-sample-repository.git terrakube mod create -n myModule2 -d "module description 2" -p azurerm -s https://github.com/AzBuilder/terraform-sample-repository.git terrakube mod create -n myModule3 -d "module description 3" -p azurerm -s https://github.com/AzBuilder/terraform-sample-repository.git ``` -------------------------------- ### GET /organization/{organizationId}/collection Source: https://github.com/terrakube-io/docs/blob/main/api/methods/collection.md Retrieves a list of collections for a given organization. ```APIDOC ## GET /organization/{organizationId}/collection ### Description Retrieves a list of collections for a given organization. ### Method GET ### Endpoint /organization/{organizationId}/collection ### Parameters #### Path Parameters - **organizationId** (string) - Required - The unique identifier of the organization. ``` -------------------------------- ### GET /organization/{organizationId}/workspace/{workspaceId} Source: https://github.com/terrakube-io/docs/blob/main/api/methods/workspace.md Retrieves details of a specific workspace. ```APIDOC ## GET /organization/{organizationId}/workspace/{workspaceId} ### Description Retrieves the information for a specific workspace. ### Method GET ### Endpoint /organization/{organizationId}/workspace/{workspaceId} ### Parameters #### Path Parameters - **organizationId** (string) - Required - The ID of the Terrakube organization. - **workspaceId** (string) - Required - The ID of the workspace. ``` -------------------------------- ### GET /organization/{organizationId}/template Source: https://github.com/terrakube-io/docs/blob/main/api/methods/template.md Searches or lists templates within an organization. ```APIDOC ## GET /organization/{organizationId}/template ### Description Searches or lists templates within an organization. ### Method GET ### Endpoint /organization/{organizationId}/template ### Parameters #### Path Parameters - **organizationId** (string) - Required - The ID of the organization. ``` -------------------------------- ### Create a Terrakube Organization Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/getting-started.md Create a new organization with a specified name and description. The output includes the organization's ID and attributes. ```bash terrakube organization create --name MyOrganization --description "Getting started Organization" ``` ```json { "attributes": { "description": "Getting started Organization", "name": "MyOrganization" }, "id": "8a6e9998-165c-49f0-953c-d3fb0924731a", "relationships": { "job": {}, "module": {}, "workspace": {} }, "type": "organization" } ``` -------------------------------- ### GET /organization/{organizationId}/template/{templateId} Source: https://github.com/terrakube-io/docs/blob/main/api/methods/template.md Retrieves details of a specific template. ```APIDOC ## GET /organization/{organizationId}/template/{templateId} ### Description Retrieves details of a specific template. ### Method GET ### Endpoint /organization/{organizationId}/template/{templateId} ### Parameters #### Path Parameters - **organizationId** (string) - Required - The ID of the organization. - **templateId** (string) - Required - The ID of the template. ``` -------------------------------- ### GET /organization/{organizationId}/agent/{agentId} Source: https://github.com/terrakube-io/docs/blob/main/api/methods/agent.md Retrieve details of a specific agent. ```APIDOC ## GET /organization/{organizationId}/agent/{agentId} ### Description Retrieve the details of a specific agent by its ID within an organization. ### Method GET ### Endpoint /organization/{organizationId}/agent/{agentId} ### Parameters #### Path Parameters - **organizationId** (string) - Required - The unique identifier of the organization. - **agentId** (string) - Required - The unique identifier of the agent. ``` -------------------------------- ### GET /workspace/{workspaceId}/schedule/{scheduleId} Source: https://github.com/terrakube-io/docs/blob/main/api/methods/schedule.md Retrieves details of a specific schedule. ```APIDOC ## GET /workspace/{workspaceId}/schedule/{scheduleId} ### Description Retrieves the details of a specific schedule by its ID within a workspace. ### Method GET ### Endpoint /workspace/{workspaceId}/schedule/{scheduleId} ### Parameters #### Path Parameters - **workspaceId** (string) - Required - The unique identifier of the workspace. - **scheduleId** (string) - Required - The unique identifier of the schedule. ``` -------------------------------- ### Terrakube Organization Create Usage Source: https://github.com/terrakube-io/docs/blob/main/user-guide/terrakube-cli/commands/azb-organization/create.md Basic syntax for executing the organization creation command. ```text terrakube organization create [flags] ``` -------------------------------- ### GET /organization/{organizationId}/agent Source: https://github.com/terrakube-io/docs/blob/main/api/methods/agent.md Retrieve a list of agents for a specific organization. ```APIDOC ## GET /organization/{organizationId}/agent ### Description Retrieve a list of all agents associated with the specified organization. ### Method GET ### Endpoint /organization/{organizationId}/agent ### Parameters #### Path Parameters - **organizationId** (string) - Required - The unique identifier of the organization. ``` -------------------------------- ### GET /workspace/{workspaceId}/schedule Source: https://github.com/terrakube-io/docs/blob/main/api/methods/schedule.md Retrieves a list of schedules for a specific workspace. ```APIDOC ## GET /workspace/{workspaceId}/schedule ### Description Retrieves all schedules associated with the specified workspace. ### Method GET ### Endpoint /workspace/{workspaceId}/schedule ### Parameters #### Path Parameters - **workspaceId** (string) - Required - The unique identifier of the workspace. ``` -------------------------------- ### Terraform Plan and Apply Source: https://github.com/terrakube-io/docs/blob/main/user-guide/workspaces/ephemeral-workspaces.md This shows the Terraform plan output indicating resources to be added and the subsequent apply process where resources are created. It includes a confirmation prompt for applying changes. ```bash # null_resource.previous will be created + resource "null_resource" "previous" { + id = (known after apply) } # time_sleep.wait_5_seconds will be created + resource "time_sleep" "wait_5_seconds" { + create_duration = "5s" + id = (known after apply) } Plan: 3 to add, 0 to change, 0 to destroy. Changes to Outputs: + creation_time = "5s" Do you want to perform these actions in workspace "myplayground"? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes ```