jamesrcounts / terraform-tfe-workspace

Configures a Terraform Cloud workspace and variables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 = "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"
    }
  }
}

Required Inputs

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

Optional Inputs

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: {}

Outputs

The following outputs are exported:

Description: The workspace id.

Description: The workspace name.

About

Configures a Terraform Cloud workspace and variables

License:MIT License


Languages

Language:Shell 90.7%Language:Dockerfile 3.8%Language:HCL 3.6%Language:Go 1.5%Language:Makefile 0.4%