Terraform File
kind: terraform/file
On this page
| source | condition | target |
|---|---|---|
✔ | ✔ | ✔ |
Description
terraform/file is an alias for hcl.
source
The Terraform file "source" retrieves an attribute from a Terraform file at configured path.
condition
The Terraform file "condition" tests that attribute at configured path matches the value in a Terraform file.
target
The Terraform file "target" ensures that an attribute at configured path in a Terraform file is set to a specific value.
Parameter
| Name | Type | Description | Required |
|---|---|---|---|
| file | string | “file” defines the hcl file path to interact with. | |
| files | array | “files” defines the list of hcl files path to interact with. | |
| path | string | “path” defines the hcl attribute path. | |
| value | string | “value” is the value associated with a hcl path. |
Example
The example uses an additional resource plugin: terraform/registry.
# updatecli.yaml
name: Terraform File
sources:
terraform-aws-modules-eks:
name: Get version from registry
kind: terraform/registry
spec:
type: module
namespace: terraform-aws-modules
name: eks
targetsystem: aws
conditions:
using-value:
name: Condition using value
kind: terraform/file
scmid: default
disablesourceinput: true
spec:
file: cik8s-cluster.tf
path: module.cik8s.source
value: terraform-aws-modules/eks/aws
targets:
update-file:
name: Update files content
kind: terraform/file
sourceid: terraform-aws-modules-eks
scmid: default
spec:
file: cik8s-cluster.tf
path: module.cik8s.version