-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from omazin/fix-documentation
Rewrite upgrade guides. Update readme. Promote using submodules
- Loading branch information
Showing
3 changed files
with
79 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,35 +61,32 @@ some additional variables to support this use case. | |
|
||
## Upgrade Instructions | ||
|
||
The generic `bindings` variable has been replaced with | ||
resource-specific variables, like `projects_bindings` or | ||
`folders_bindings`. Additionally, to support cases where dynamic values | ||
are used to define the bindings or the bindings targets, number | ||
variables are available to provide a static count of the contents, like | ||
`projects_num` and `projects_bindings_num`. Both `*_num` | ||
variables must be used regardless of which variable contains the | ||
dynamic content. | ||
|
||
To continue from the previous example, the following configurations | ||
highlight the changes required to upgrade the module to 3.0. | ||
We recommend using individual bindings target submodules that can be invoked | ||
directly. The following configurations highlight the approach in 3.0: | ||
|
||
```diff | ||
module "iam" { | ||
source = "terraform-google-modules/iam/google" | ||
- source = "terraform-google-modules/iam/google" | ||
+ source = "terraform-google-modules/iam/google//modules/projects_iam" | ||
- version = "~> 2.0" | ||
+ version = "~> 3.0" | ||
|
||
projects = ["project-123456"] | ||
|
||
- bindings = { | ||
+ projects_bindings = { | ||
bindings = { | ||
"roles/storage.admin" = [ | ||
"serviceAccount:[email protected]", | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Additionally, to support cases where dynamic values | ||
are used to define the bindings or the bindings targets, number | ||
variables are available to provide a static count of the contents, e.g. | ||
`projects_num` and `bindings_num`. Both `*_num` variables must be used | ||
regardless of which variable contains the dynamic content: | ||
|
||
```diff | ||
module "project_factory" { | ||
source = "terraform-google-modules/project-factory/google" | ||
|
@@ -103,45 +100,64 @@ highlight the changes required to upgrade the module to 3.0. | |
} | ||
|
||
module "iam" { | ||
source = "terraform-google-modules/iam/google" | ||
- source = "terraform-google-modules/iam/google" | ||
+ source = "terraform-google-modules/iam/google//modules/projects_iam" | ||
- version = "~> 2.0" | ||
+ version = "~> 3.0" | ||
|
||
projects = [module.project_factory.project_id] | ||
|
||
+ projects_num = 1 | ||
|
||
- bindings = { | ||
+ projects_bindings = { | ||
bindings = { | ||
"roles/storage.admin" = [ | ||
"serviceAccount:${module.project_factory.service_account_email}", | ||
] | ||
} | ||
|
||
+ projects_bindings_num = 1 | ||
+ bindings_num = 1 | ||
} | ||
``` | ||
|
||
Alternatively, individual bindings target submodules can be invoked | ||
directly. The following configurations highlight that approach. | ||
Alternatively, you can use a root module where generic `bindings` variable has | ||
been replaced with resource-specific variables, like `projects_bindings` or | ||
`folders_bindings`. To continue from the previous example, the following | ||
configurations highlight the changes required to upgrade the module to 3.0: | ||
|
||
```diff | ||
module "iam" { | ||
- source = "terraform-google-modules/iam/google" | ||
+ source = "terraform-google-modules/iam/google//modules/projects_iam" | ||
source = "terraform-google-modules/iam/google" | ||
- version = "~> 2.0" | ||
+ version = "~> 3.0" | ||
|
||
projects = ["project-123456"] | ||
|
||
bindings = { | ||
- bindings = { | ||
+ projects_bindings = { | ||
"roles/storage.admin" = [ | ||
"serviceAccount:[email protected]", | ||
] | ||
} | ||
|
||
+ pubsub_topics_bindings = {} | ||
+ pubsub_subscriptions_bindings = {} | ||
+ storage_buckets_bindings = {} | ||
+ subnets_bindings = {} | ||
+ subnets_region = "" | ||
+ organizations_bindings = {} | ||
+ kms_crypto_keys_bindings = {} | ||
+ kms_key_rings_bindings = {} | ||
+ service_accounts_bindings = {} | ||
+ folders_bindings = {} | ||
} | ||
``` | ||
|
||
In case of dynamic values are used to define the bindings or the bindings | ||
targets, number variables, e.g. `projects_num` and `projects_bindings_num`, | ||
are available to provide a static count of the contents. Both `*_num` | ||
variables must be used regardless of which variable contains the | ||
dynamic content: | ||
|
||
```diff | ||
module "project_factory" { | ||
source = "terraform-google-modules/project-factory/google" | ||
|
@@ -155,20 +171,32 @@ directly. The following configurations highlight that approach. | |
} | ||
|
||
module "iam" { | ||
- source = "terraform-google-modules/iam/google" | ||
+ source = "terraform-google-modules/iam/google//modules/projects_iam" | ||
source = "terraform-google-modules/iam/google" | ||
- version = "~> 2.0" | ||
+ version = "~> 3.0" | ||
|
||
projects = [module.project_factory.project_id] | ||
|
||
+ projects_num = 1 | ||
|
||
bindings = { | ||
- bindings = { | ||
+ projects_bindings = { | ||
"roles/storage.admin" = [ | ||
"serviceAccount:${module.project_factory.service_account_email}", | ||
] | ||
} | ||
|
||
+ bindings_num = 1 | ||
+ projects_bindings_num = 1 | ||
|
||
+ pubsub_topics_bindings = {} | ||
+ pubsub_subscriptions_bindings = {} | ||
+ storage_buckets_bindings = {} | ||
+ subnets_bindings = {} | ||
+ subnets_region = "" | ||
+ organizations_bindings = {} | ||
+ kms_crypto_keys_bindings = {} | ||
+ kms_key_rings_bindings = {} | ||
+ service_accounts_bindings = {} | ||
+ folders_bindings = {} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters