Skip to content

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

@just-shak

Description

@just-shak
  • 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:

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:

{
  "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 ?

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions