googleapis / googleapis/release-please

Update terraform module source references with its package version in a monorepo

Open
#2,807 0 comments 0 reactions 1 assignee Claimed by @chingor13 View on GitHub
priority: p3 type: question
Dominant language
TypeScript
Stars
7.5k
Forks
588
Avg merge
12h 16m
Merged PRs (30d)
7

Description

- What you're trying to do

I am trying to use release-please to version terraform module in a monorepo architecture.
The terraform modules are stored in "`module/*`" path and the global terraform code in "`global/*`"
I was successful generating versions for each of the module packages. I now want to update the terraform module source version in the other files situated in "global/*"

- What code you've already tried

I tried using the generic updater with the code flags:
```hcl
module "test_gcp" {
# x-release-please-start-version
source = "git@github.com:org/repo.git?ref=gcp_bucket_sa_v0.2.4"
# x-release-please-end
}
```
And even with the inline flag: `# x-release-please-version` without success.
Until I saw in the logs that the file path was not recognized because it is located outside the package path (ex: `global/terraform/module_gcp.tf`)

- Any error messages you're getting

Then I also tried using globs or relative path, but still got error for not getting the file:
exemple:
`Error: release-please failed: illegal pathing characters in path: modules/gcp_bucket_sa/../../global/terraform/modules_gcp.tf`

Here is a part of my config file:
```yaml
{
"packages": {
"modules/gcp_bucket_sa": {
"component": "gcp_bucket_sa",
"changelog-path": "CHANGELOG.md",
"release-type": "terraform-module",
"bump-minor-pre-major": false,
"bump-patch-for-minor-pre-major": false,
"draft": false,
"prerelease": false,
"extra-files": [
{
"type": "generic",
"path": "global/terraform/modules_gcp.tf",
}
]
}
},
"tag-separator": "_",
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
```
Is there any way to update a file with the right package version somewhere else in the same repository or is there another method available ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.