Terraform Lock

kind: terraform/lock

sourceconditiontarget

Description

condition

The terraform/lock "condition" tests that lock file version and hashes match the value for a given provider.

target

The terraform/lock "target" ensures that an the lock file version and hashes are update to date for given provider.

Parameter

NameTypeDescriptionRequired
filestring

“file” defines the terraform lock file path to interact with.

	compatible:
		* condition
		* target

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

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

	compatible:
		* condition
		* target

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

“platforms” is the target platforms to request package checksums for.

	compatible:
		* condition
		* target
providerstring

“provider” is the terraform provider you wish to update, supports with or without registry url.

	compatible:
		* condition
		* target
skipconstraintsboolean

“skipconstraints” will control whether the constraint in lock file is updated

	compatible:
		* condition
		* target

	NOTE: That turning this off can break the lockfile if version value source does not follow the constraints
valuestring

“value” is the value associated with a terraform provider.

	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 Lock

sources:
  kubernetes:
    name: Get version from registry
    kind: terraform/registry
    spec:
      type: provider
      namespace: hashicorp
      name: kubernetes

conditions:
  using-value:
    name: Condition using value
    kind: terraform/lock
    disablesourceinput: true
    spec:
      file: .terraform.lock.hcl
      provider: hashicorp/kubernetes
      platforms:
        - linux_amd64
      value: 2.22.0

  https:
    name: Condition using HTTP
    kind: terraform/lock
    disablesourceinput: true
    spec:
      file: https://raw.githubusercontent.com/updatecli-test/jenkins-infra-aws/main/.terraform.lock.hcl
      provider: hashicorp/kubernetes
      platforms:
        - linux_amd64
      value: 2.22.0


targets:
  update-file-from-source:
    name: Update files content from value
    kind: terraform/lock
    sourceid: kubernetes
    spec:
      file: .terraform.lock.hcl
      provider: hashicorp/kubernetes
      platforms:
        - linux_amd64
Top