We're trying to use renovate bot in order to update the terraform version in the provider.tf file. We're using the terraform release site (/) for the custom data source. The manager itself is working fine but we're trying to use a filter which filters out the Alpha, Beta and RC versions but we're not getting there just yet. It either picks up the 1.12.0-alphaXXXXX version and places it as 1.12.0 in our provider.tf or it won't work at all and it closes the branch.
I've tried using the AllowedVersions function in Renovate in order to properly filter out versions I don't want but it's not picking up even though a regex editor is showing that it should work.
Here's my code which we built upon:
{
"$schema": ".json",
"forkProcessing": "enabled",
"dependencyDashboard": true,
"assignees": ["[email protected]", "[email protected]"],
"terraform": {
"enabled": true
},
"html": {
"enabled": true
},
"customDatasources": {
"terraform": {
"defaultRegistryUrlTemplate": "/",
"format": "html"
}
},
"customManagers": [
{
"customType": "regex",
"fileMatch": [
".*\\.tf$"
],
"matchStrings": [
"required_version\\s*=\\s*\"=\\s*(?<currentValue>\\d+\\.\\d+\\.\\d+)\""
],
"datasourceTemplate": "custom.terraform",
"depNameTemplate": "terraform",
"versioningTemplate": "regex:^v?(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$"
}
],
"packageRules": [
{
"matchDatasources": [
"custom.terraform"
],
"extractVersion": "(?<version>\\d+\\.\\d+\\.\\d+)"
}
]
}
The code above is picking up the 1.12.0 and edits my files just fine. But in this case I don't want the 1.12.0 seeing as it's an alpha versions and I would like Renovate to pick up the latest stable, which is terraform_1.11.3 without any suffixes and we tried these variants:
"allowedVersions": "^(?!.(alpha|beta|rc)).$" "allowedVersions": "!/-$/"
Logging when using default settings:
"currentValue": "= 1.3.7",
"depType": "required_version",
"datasource": "github-releases",
"depName": "hashicorp/terraform",
"extractVersion": "v(?<version>.*)$",
"versioning": "hashicorp",
"skipReason": "github-token-required",
"updates": [],
"packageName": "hashicorp/terraform"
}
],
My input file:
terraform {
required_version = "= 1.3.7"
required_providers {
azurerm = {
version = "4.25.0"
}
}
}