Configures a Terraform Cloud workspace and variables
resource "random_pet" "project" {}
resource "tfe_organization" "org" {
name = "test-${random_pet.project.id}"
email = "nobody@example.com"
}
resource "tfe_oauth_client" "github" {
organization = tfe_organization.org.name
api_url = "https://api.github.com"
http_url = "https://github.com"
oauth_token = var.github_pat
service_provider = "github"
}
module "test_ws" {
source = "../../"
name = "ws-test"
oauth_token_id = tfe_oauth_client.github.oauth_token_id
organization_name = tfe_organization.org.name
repository_id = "jamesrcounts/terraform-tfe-workspace"
terraform_directory = "examples/default"
environment = {
MY_SECRET = {
description = "This is a big secret"
sensitive = true
value = "I<3U"
}
}
variables = {
MY_PAT = {
description = "Secret token"
sensitive = true
value = "t0pS3cret"
}
}
}
The following input variables are required:
Description: (Required) The workspace name.
Type: string
Description: (Required) The token used to access the VCS provider.
Type: string
Description: (Required) The organization to create the workspace in.
Type: string
Description: (Required) The repository containing Terraform configuration for this workspace.
Type: string
The following input variables are optional (have default values):
Description: (Optional) Map of environment variables to create in the workspace.
Type:
map(object({
description = string
sensitive = bool
value = string
}))
Default: {}
Description: (Optional) The directory that Terraform will execute within.
Type: string
Default: ""
Description: (Optional) Map of terraform variables to create in the workspace.
Type:
map(object({
description = string
sensitive = bool
value = string
}))
Default: {}
The following outputs are exported:
Description: The workspace id.
Description: The workspace name.