Terraform File

kind: terraform/file

sourceconditiontarget

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

NameTypeDescriptionRequired
filestring

“file” defines the hcl file path to interact with.

	compatible:
		* source
		* condition
		* target

	remark:
		* "file" and "files" are mutually exclusive
		* protocols "https://", "http://", and "file://" are supported in path for source and condition
filesarray

“files” defines the list of hcl files path to interact with.

	compatible:
		* source
		* condition
		* target

	remark:
		* file and files are mutually exclusive
		* when using as a source only one file is supported
		* protocols "https://", "http://", and "file://" are supported in file path for source and condition
pathstring

“path” defines the hcl attribute path.

	compatible:
		* source
		* condition
		* target

	example:
		* path: resource.aws_instance.app_server.ami
		* path: resource.helm_release.prometheus.version
		* path: plugin.aws.version
valuestring

“value” is the value associated with a hcl path.

	compatible:
		* condition
		* target

	default:
		When used from a condition or a target, the default value is set to linked source output.

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
Top