A Workspace of Terraform Configuration.
Type
CRD
Group
tf.upbound.io
Version
v1beta1
apiVersion: tf.upbound.io/v1beta1
kind: Workspace
A WorkspaceSpec defines the desired state of a Workspace.
WorkspaceParameters are the configurable fields of a Workspace.
Arguments to be included in the terraform apply CLI command
Arguments to be included in the terraform destroy CLI command
Arguments to be included in the terraform init CLI command
Arguments to be included in the terraform plan CLI command
Files of configuration variables. Explicitly declared vars take precedence.
ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured.
Policies for referencing.
ProviderReference specifies the provider that will be used to create, observe, update, and delete this managed resource. Deprecated: Please use ProviderConfigReference, i.e. providerConfigRef
Policies for referencing.
PublishConnectionDetailsTo specifies the connection secret config which contains a name, metadata and a reference to secret store config to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource.
WriteConnectionSecretToReference specifies the namespace and name of a Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. This field is planned to be replaced in a future release in favor of PublishConnectionDetailsTo. Currently, both could be set independently and connection details would be published to both without affecting each other.
A WorkspaceStatus represents the observed state of a Workspace.
Conditions of the resource.
sample-remote
apiVersion: tf.upbound.io/v1beta1
kind: Workspace
metadata:
name: sample-remote
spec:
forProvider:
module: git::https://github.com/ytsarev/provider-terraform-test-module.git//transition?ref=main
source: Remote
vars:
- key: vpcName
value: sample-tf-remote
sample-inline
apiVersion: tf.upbound.io/v1beta1
kind: Workspace
metadata:
name: sample-inline
spec:
forProvider:
module: |
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
tags = {
Name = var.vpcName
}
}
resource "aws_subnet" "main" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
}
output "vpc_id" {
value = aws_vpc.main.id
}
output "subnet_id" {
value = aws_subnet.main.id
}
variable "vpcName" {
description = "VPC name"
type = string
}
source: Inline
vars:
- key: vpcName
value: sample-tf-inline
providerConfigRef:
name: aws-eu-west-1
example-remote
apiVersion: tf.upbound.io/v1beta1
kind: Workspace
metadata:
annotations:
crossplane.io/external-name: myworkspace
meta.upbound.io/example-id: tf/v1beta1/workspace
name: example-remote
spec:
forProvider:
module: git::https://github.com/crossplane/tf?ref=main
source: Remote
varFiles:
- configMapKeyRef:
key: example.tfvars
name: terraform
namespace: default
source: ConfigMapKey
- format: JSON
secretKeyRef:
key: example.tfvar.json
name: terraform
namespace: default
source: SecretKey
vars:
- key: region
value: us-west-1
writeConnectionSecretToRef:
name: terraform-workspace-example-remote
namespace: default
sample-inline
apiVersion: tf.upbound.io/v1beta1
kind: Workspace
metadata:
name: sample-inline
spec:
forProvider:
module: |
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
tags = {
Name = var.vpcName
}
}
resource "aws_subnet" "main" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
}
output "vpc_id" {
value = aws_vpc.main.id
}
output "subnet_id" {
value = aws_subnet.main.id
}
variable "vpcName" {
description = "VPC name"
type = string
}
source: Inline
vars:
- key: vpcName
value: sample-tf-inline
example-inline
apiVersion: tf.upbound.io/v1beta1
kind: Workspace
metadata:
annotations:
crossplane.io/external-name: coolbucket
meta.upbound.io/example-id: tf/v1beta1/workspace
name: example-inline
spec:
forProvider:
module: >
// Outputs are written to the connection secret.
output "url" {
value = google_storage_bucket.example.self_link
}
resource "random_id" "example" {
byte_length = 4
}
// The google provider and remote state are configured by the provider
// config - see providerconfig.yaml.
resource "google_storage_bucket" "example" {
name = "crossplane-example-${terraform.workspace}-${random_id.example.hex}"
location = "US"
force_destroy = true
public_access_prevention = "enforced"
}
source: Inline
writeConnectionSecretToRef:
name: terraform-workspace-example-inline
namespace: default