Skip to content

Commit

Permalink
Add module_prefix to modules_config
Browse files Browse the repository at this point in the history
- Add module_prefix to modules_config
- Add example to Readme.md
- use module_prefix variable to specify the path
  • Loading branch information
antonkovach committed Feb 19, 2023
1 parent 13a7d3c commit 20ed68e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions fast/extras/0-cicd-github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ modules_config = {
# tftest skip
```

If the modules are located in a non modules only repository, use the module_prefix attribute to set the location of your modules within the repository:

```hcl
modules_config = {
repository_name = "GoogleCloudPlatform/cloud-foundation-fabric"
module_prefix = "modules/"
}
# tftest skip
```

In the above example, no key options are set so it's assumed modules will be fetched from a public repository. If modules repository authentication is needed the `key_config` attribute also needs to be set.

If no keypair path is specified an internally generated key will be stored as an access key in the modules repository, and as secrets in the stage repositories:
Expand Down
2 changes: 1 addition & 1 deletion fast/extras/0-cicd-github/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ resource "github_repository_file" "default" {
? replace(
file(each.value.file),
"/source(\\s*)=\\s*\"../../../modules/([^/\"]+)\"/",
"source$1= \"[email protected]:${local.modules_repo}.git//$2${local.modules_ref}\"" # "
"source$1= \"[email protected]:${local.modules_repo}.git//${local.module_prefix}$2${local.modules_ref}\"" # "
)
: file(each.value.file)
)
Expand Down
1 change: 1 addition & 0 deletions fast/extras/0-cicd-github/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ variable "modules_config" {
type = object({
repository_name = string
source_ref = optional(string)
module_prefix = optional(string, "")
key_config = optional(object({
create_key = optional(bool, false)
create_secrets = optional(bool, false)
Expand Down

0 comments on commit 20ed68e

Please sign in to comment.