terraform.star¶
Bump Terraform's required_version and provider version constraints.
Edits are line-based, so comments and alignment in .tf files stay as they
were. .terraform.lock.hcl is not touched; run terraform init -upgrade
in CI or a run step to refresh it.
| Function | What it does |
|---|---|
files |
Lists the repo's Terraform files. |
set_required_version |
Sets every required_version constraint. |
set_provider_version |
Sets the version constraint of a provider in required_providers. |
files¶
Lists the repo's Terraform files.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The sorted paths of every .tf file outside .terraform directories.
Example
set_required_version¶
Sets every required_version constraint.
A newer version already there is kept, so a campaign never lowers one.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
constraint |
The new constraint, such as >= 1.9. |
Returns: The list of paths that changed.
Example
Used in: terraform-provider-bump
set_provider_version¶
Sets the version constraint of a provider in required_providers.
A newer version already there is kept, so a campaign never lowers one.
Works on entries written as a block or on one line
(aws = { source = "hashicorp/aws", version = "~> 5.0" }), and on
sources with the registry.terraform.io/ prefix. Entries without a
version are left alone.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
source |
The provider source, such as hashicorp/aws. |
constraint |
The new constraint, such as ~> 5.0. |
Returns: The list of paths that changed.
Example
Used in: terraform-provider-bump