terraform-tfe-workspace
Configures a Terraform Cloud workspace and variables
Example
resource "random_pet" "project" {}
resource "tfe_organization" "org" {
name = "test-${random_pet.project.id}"
email = "[email protected]"
}
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"
}
}
}
Required Inputs
The following input variables are required:
name
Description: (Required) The workspace name.
Type: string
oauth_token_id
Description: (Required) The token used to access the VCS provider.
Type: string
organization_name
Description: (Required) The organization to create the workspace in.
Type: string
repository_id
Description: (Required) The repository containing Terraform configuration for this workspace.
Type: string
Optional Inputs
The following input variables are optional (have default values):
environment
Description: (Optional) Map of environment variables to create in the workspace.
Type:
map(object({
description = string
sensitive = bool
value = string
}))
Default: {}
terraform_directory
Description: (Optional) The directory that Terraform will execute within.
Type: string
Default: ""
variables
Description: (Optional) Map of terraform variables to create in the workspace.
Type:
map(object({
description = string
sensitive = bool
value = string
}))
Default: {}
Outputs
The following outputs are exported:
id
Description: The workspace id.
name
Description: The workspace name.