HCL

kind: hcl

sourceconditiontarget

Description

source

The HCL "source" retrieves an attribute from a HCL file at configured path.

condition

The HCL "condition" tests that attribute at configured path matches the value in a HCL file.

target

The HCL "target" ensures that an attribute at configured path in a HCL 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

# updatecli.yaml
name: Basic HCL Example

scms:
  default:
    kind: git
    spec:
      url: https://github.com/updatecli/updatecli.git

sources:
  local:
    name: Get value from hcl
    kind: hcl
    scmid: default
    spec:
      file: pkg/plugins/resources/hcl/testdata/data.hcl
      path: resource.person.john.first_name
  http:
    name: Get value from hcl
    kind: hcl
    spec:
      file: https://raw.githubusercontent.com/updatecli/updatecli/master/pkg/plugins/resources/hcl/testdata/data.hcl
      path: resource.person.john.first_name

conditions:
  local:
    name: Test value from hcl
    kind: hcl
    sourceid: local
    scmid: default
    spec:
      file: pkg/plugins/resources/hcl/testdata/data.hcl
      path: resource.person.john.first_name
  http:
    name: Test value from hcl
    kind: hcl
    disablesourceinput: true
    spec:
      file: https://raw.githubusercontent.com/updatecli/updatecli/master/pkg/plugins/resources/hcl/testdata/data.hcl
      path: resource.person.john.first_name
      value: John

targets:
  local:
    name: Test value from hcl
    kind: hcl
    sourceid: local
    scmid: default
    spec:
      file: pkg/plugins/resources/hcl/testdata/data.hcl
      path: resource.person.john.first_name
      value: John

Top