Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge new modules list and environments foundation example #30

Merged
merged 109 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
e2cceab
gke-cluster
ludoo Nov 24, 2019
690fc89
net-vpc module and tests
ludoo Nov 25, 2019
544d023
add TODO to net-vpc module
ludoo Nov 25, 2019
c964738
add minimal README files with input/output variables to gke and net-v…
ludoo Nov 26, 2019
be68e1e
BigQuery Module (#24)
juliocc Nov 28, 2019
653dd70
gke-cluster
ludoo Nov 24, 2019
814915d
net-vpc module and tests
ludoo Nov 25, 2019
db5005e
add TODO to net-vpc module
ludoo Nov 25, 2019
370c5fe
add minimal README files with input/output variables to gke and net-v…
ludoo Nov 26, 2019
8930b94
BigQuery Module (#24)
juliocc Nov 28, 2019
8d54b49
Merge branch 'ludo-modules' of github.com:terraform-google-modules/cl…
ludoo Nov 28, 2019
8eb8fc2
GCS module
ludoo Dec 8, 2019
aa3a184
net vpc module: improve secondary range outputs
ludoo Dec 9, 2019
61cd657
net vpc module: add serve project registration
ludoo Dec 9, 2019
8a1c783
project module
ludoo Dec 9, 2019
9e20918
move bigquery module to not-ready folder
ludoo Dec 14, 2019
26ab786
folders module
ludoo Dec 14, 2019
fc92d30
rename project module's iam variables
ludoo Dec 14, 2019
54d634d
slight tweak to folder module outputs
ludoo Dec 14, 2019
d29b771
gcs module
ludoo Dec 14, 2019
4f80c61
simplify net-vpc module variables
ludoo Dec 15, 2019
d0e51c7
fix module tests configurations, fix net-vpc module tests
ludoo Dec 15, 2019
dded3a6
add pydoc utility
ludoo Dec 15, 2019
433b4df
add/update module READMEs
ludoo Dec 15, 2019
07e1920
add/update module READMEs
ludoo Dec 15, 2019
b1f0273
add/update module READMEs
ludoo Dec 15, 2019
82b20ab
improve variable type summary generation in tfdoc
ludoo Dec 15, 2019
62f8ddb
tfdoc: add support for replacing doc in README.md files
ludoo Dec 15, 2019
6ad99ee
improve module READMEs
ludoo Dec 15, 2019
7973a9b
net-vpc-firewall module
ludoo Dec 16, 2019
162fd23
add support for sensitive output attribute in tfdoc
ludoo Dec 16, 2019
1b574f8
remove empty function from tfdoc
ludoo Dec 16, 2019
e092293
render variable type as code in tfdoc
ludoo Dec 16, 2019
5e02abe
update module READMEs
ludoo Dec 16, 2019
6591636
net address module
ludoo Dec 16, 2019
0edb9da
net cloudnat module
ludoo Dec 16, 2019
21a0d07
remove redundant variable from net-cloudnat module
ludoo Dec 17, 2019
c40edfa
vpc module: add support for peering, use network name as subnet name …
ludoo Dec 17, 2019
b6a295f
net-vpn-static module
ludoo Dec 17, 2019
3890691
net-vpn-static module README
ludoo Dec 17, 2019
5d71382
net-vpn-static module README
ludoo Dec 17, 2019
5340bbd
tfdoc: fix error on undeclared variable type
ludoo Dec 17, 2019
5cb2f4d
dns module
ludoo Dec 17, 2019
9760af2
set version for all modules
ludoo Dec 17, 2019
438cfd7
kms module (untested)
ludoo Dec 17, 2019
dfcdc26
change kms key self links output to map, fix gcs and kms iam variable…
ludoo Dec 17, 2019
172cf9f
fix kms module
ludoo Dec 18, 2019
c3e6001
update kms module readme
ludoo Dec 18, 2019
cbc276e
simplify local iam pairs in modules
ludoo Dec 18, 2019
9ac87b9
service accounts module (unfinished)
ludoo Dec 18, 2019
b9ed136
work on service accounts module
ludoo Dec 18, 2019
339c53f
project module: add gcr service account
ludoo Dec 18, 2019
0c66f7f
Merge branch 'ludo-modules' of github.com:terraform-google-modules/cl…
ludoo Dec 18, 2019
664a06c
project module: update outputs in README
ludoo Dec 18, 2019
ea97a93
first working version of the iam service accounts module
ludoo Dec 18, 2019
9ea16b2
iam service accounts module: extra checks in locals
ludoo Dec 19, 2019
9fb15ce
modules/net-cloudnat: reorder variables
ludoo Dec 19, 2019
1b6dea7
modules/net-vpn-dynamic: initial import (untested)
ludoo Dec 19, 2019
fac51b5
modules/net-vpn-dynamic: first working version
ludoo Dec 19, 2019
bb0df9f
modules/net-vpn-dynamic: add outputs for auto-created router
ludoo Dec 19, 2019
529f8cc
modules/net-vpn-dynamic: update README
ludoo Dec 19, 2019
9c07882
modules/net-[vpn,cloudnat]: clean up variable,s remove prefix
ludoo Dec 20, 2019
73fa5be
modules/net-vpn-dynamic: add advertisement configuration to tunnel bg…
ludoo Dec 20, 2019
cd17ec6
tfdoc: add tooltips for variable types and defaults
ludoo Dec 20, 2019
8fde9a8
modules: update README variables and outputs
ludoo Dec 20, 2019
b38f086
tfdoc: improve variable default rendering
ludoo Dec 20, 2019
cce1e76
modules: update README variables and outputs
ludoo Dec 20, 2019
535457d
modules/net-vpc: minimal output refactoring
ludoo Dec 21, 2019
36d46f4
modules/vm-cos: initial import, base resources working, no outputs
ludoo Dec 21, 2019
567acb4
modules/vm-cos: add variable descriptions
ludoo Dec 21, 2019
7013fd9
tfdoc: fix parsing in type and default blocks
ludoo Dec 21, 2019
26aa479
modules/vm-cos: fix README
ludoo Dec 21, 2019
554747e
tfdoc: fix parsing in type and default blocks
ludoo Dec 21, 2019
18ae75d
modules/vm-cos: fix README
ludoo Dec 21, 2019
5e7e9fb
modules/compute-vm: initial working import (not fully tested)
ludoo Dec 22, 2019
5a372b2
modules/vm-cos: move to not-ready
ludoo Dec 22, 2019
9051984
tfdoc: fix variable defaults formatting
ludoo Dec 22, 2019
b5875a2
modules: update README files with tfdoc fixes
ludoo Dec 22, 2019
aecd928
modules: add initial examples
ludoo Dec 22, 2019
386acf5
gke-nodepool: initial import, untested
ludoo Jan 4, 2020
b004c37
gke nodepool: add README, fix location variable, set node count defau…
ludoo Jan 4, 2020
0f3d340
gke cluster: fix private cluster variables
ludoo Jan 4, 2020
5b8d9dd
gke nodepool: fix README title
ludoo Jan 4, 2020
c6708d9
gke cluster: add output for cluster location
ludoo Jan 4, 2020
30984a8
gke nodepool: add missing variables for project id and cluster name, …
ludoo Jan 4, 2020
7abd9c3
gke nodepool: update README
ludoo Jan 4, 2020
31423c0
net-cloudnat: fix router name when creating default router
ludoo Jan 5, 2020
07c8643
fix variables used for address and router optional creation
ludoo Jan 5, 2020
384e23d
vpn dynamic: fix README
ludoo Jan 5, 2020
6619333
modules/net-vpn-dynamic: fix router name output
ludoo Jan 6, 2020
ef8c3c7
modules/compute-vm: remove unused variable
ludoo Jan 6, 2020
c791718
modules/compute-vm-cos-coredns: initial import
ludoo Jan 6, 2020
b48094a
Update foundations modules versions (#26)
ludoo Jan 10, 2020
0a63efa
backport tfdoc from Ludo's branch (#27)
ludoo Jan 10, 2020
253c51d
Update docs using tfdoc format (#28)
ludoo Jan 10, 2020
9877cb1
foundations/environments: move log filter to a variable, use org for …
ludoo Jan 10, 2020
e8a9d73
foundations/environments: do not use liens by default
ludoo Jan 10, 2020
c32ea31
modules/ntp-vpc: better shared_vpc_host variable description
ludoo Jan 11, 2020
77c90fb
modules/logging-sinks: initial version
ludoo Jan 11, 2020
26f7aeb
modules/logging-sinks: streamline options in sinks variable
ludoo Jan 11, 2020
b125f0b
modules/compute-vm-cos-coredns: add support for additional files
ludoo Jan 12, 2020
517b52e
Merge branch 'master' into ludo-modules
ludoo Jan 12, 2020
0bb9ac0
modules/folders: rename from 'folder'
ludoo Jan 12, 2020
b7608f8
modules/logging-sinks: fix circular dependencies and improve variables
ludoo Jan 12, 2020
c3d16b2
modules/project: remove extra variable
ludoo Jan 12, 2020
331dea0
modules/bigquery: new module with dataset support only
ludoo Jan 12, 2020
f3c965c
foundations/environments: refactor using local modules
ludoo Jan 12, 2020
09a754c
modules/bigquery: better variables, README description and example
ludoo Jan 13, 2020
dc0e065
modules: fix a few READMEs
ludoo Jan 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/cloudbuild.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ steps:
- PYTHONDONTWRITEBYTECODE=true

substitutions:
_TERRAFORM_VERSION: 0.12.8
_TERRAFORM_VERSION: 0.12.19

tags:
- "ci"
Expand Down
75 changes: 37 additions & 38 deletions foundations/business-units/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,44 @@ The number of resources in this sample is kept to a minimum so as to make it gen

This sample uses a top-level folder to encapsulate projects that host resources that are not specific to a single environment. If no shared services are needed,the Terraform and audit modules can be easily attached to the root node, and the shared services folder and project removed from `main.tf`.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs
<!-- BEGIN TFDOC -->
## Variables

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| audit\_viewers | Audit project viewers, in IAM format. | list | `<list>` | no |
| billing\_account\_id | Billing account id used as default for new projects. | string | n/a | yes |
| business\_unit\_1\_name | Business unit 1 short name. | string | n/a | yes |
| business\_unit\_2\_name | Business unit 2 short name. | string | n/a | yes |
| business\_unit\_3\_name | Business unit 3 short name. | string | n/a | yes |
| environments | Environment short names. | list(string) | n/a | yes |
| gcs\_location | GCS bucket location. | string | `"EU"` | no |
| generate\_service\_account\_keys | Generate and store service account keys in the state file. | string | `"false"` | no |
| organization\_id | Organization id. | string | n/a | yes |
| prefix | Prefix used for resources that need unique names. | string | n/a | yes |
| project\_services | Service APIs enabled by default in new projects. | list | `<list>` | no |
| root\_node | Root node for the new hierarchy, either 'organizations/org_id' or 'folders/folder_id'. | string | n/a | yes |
| shared\_bindings\_members | List of comma-delimited IAM-format members for the additional shared project bindings. | list | `<list>` | no |
| shared\_bindings\_roles | List of roles for additional shared project bindings. | list | `<list>` | no |
| terraform\_owners | Terraform project owners, in IAM format. | list | `<list>` | no |
| name | description | type | required | default |
|---|---|:---: |:---:|:---:|
| billing_account_id | Billing account id used as default for new projects. | <code title="">string</code> | ✓ | |
| business_unit_1_name | Business unit 1 short name. | <code title="">string</code> | | |
| business_unit_2_name | Business unit 2 short name. | <code title="">string</code> | | |
| business_unit_3_name | Business unit 3 short name. | <code title="">string</code> | | |
| environments | Environment short names. | <code title="list&#40;string&#41;">list(string)</code> | | |
| organization_id | Organization id. | <code title="">string</code> | | |
| prefix | Prefix used for resources that need unique names. | <code title="">string</code> | | |
| root_node | Root node for the new hierarchy, either 'organizations/org_id' or 'folders/folder_id'. | <code title="">string</code> | | |
| *audit_viewers* | Audit project viewers, in IAM format. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *gcs_location* | GCS bucket location. | <code title="">string</code> | | <code title="">EU</code> |
| *generate_service_account_keys* | Generate and store service account keys in the state file. | <code title="">bool</code> | | <code title="">false</code> |
| *project_services* | Service APIs enabled by default in new projects. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="&#91;&#10;&#34;resourceviews.googleapis.com&#34;,&#10;&#34;stackdriver.googleapis.com&#34;,&#10;&#93;">...</code> |
| *shared_bindings_members* | List of comma-delimited IAM-format members for the additional shared project bindings. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *shared_bindings_roles* | List of roles for additional shared project bindings. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *terraform_owners* | Terraform project owners, in IAM format. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |

## Outputs

| Name | Description |
|------|-------------|
| audit\_logs\_bq\_dataset | Bigquery dataset for the audit logs export. |
| audit\_logs\_project | Project that holds the audit logs export resources. |
| bootstrap\_tf\_gcs\_bucket | GCS bucket used for the bootstrap Terraform state. |
| business\_unit\_1\_environment\_folders\_ids | Business unit 1 environment folders. |
| business\_unit\_1\_folder\_id | Business unit 1 top-level folder ID. |
| business\_unit\_2\_environment\_folders\_ids | Business unit 2 environment folders. |
| business\_unit\_2\_folder\_id | Business unit 2 top-level folder ID. |
| business\_unit\_3\_environment\_folders\_ids | Business unit 3 environment folders. |
| business\_unit\_3\_folder\_id | Business unit 3 top-level folder ID. |
| environment\_service\_account\_keys | Service account keys used to run each environment Terraform modules. |
| environment\_service\_accounts | Service accounts used to run each environment Terraform modules. |
| environment\_tf\_gcs\_buckets | GCS buckets used for each environment Terraform state. |
| shared\_folder\_id | Shared folder ID. |
| shared\_resources\_project | Project that holdes resources shared across business units. |
| terraform\_project | Project that holds the base Terraform resources. |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
| name | description | sensitive |
|---|---|:---:|
| audit_logs_bq_dataset | Bigquery dataset for the audit logs export. | |
| audit_logs_project | Project that holds the audit logs export resources. | |
| bootstrap_tf_gcs_bucket | GCS bucket used for the bootstrap Terraform state. | |
| business_unit_1_environment_folders_ids | Business unit 1 environment folders. | |
| business_unit_1_folder_id | Business unit 1 top-level folder ID. | |
| business_unit_2_environment_folders_ids | Business unit 2 environment folders. | |
| business_unit_2_folder_id | Business unit 2 top-level folder ID. | |
| business_unit_3_environment_folders_ids | Business unit 3 environment folders. | |
| business_unit_3_folder_id | Business unit 3 top-level folder ID. | |
| environment_service_account_keys | Service account keys used to run each environment Terraform modules. | ✓ |
| environment_service_accounts | Service accounts used to run each environment Terraform modules. | |
| environment_tf_gcs_buckets | GCS buckets used for each environment Terraform state. | |
| shared_folder_id | Shared folder ID. | |
| shared_resources_project | Project that holdes resources shared across business units. | |
| terraform_project | Project that holds the base Terraform resources. | |
<!-- END TFDOC -->
8 changes: 4 additions & 4 deletions foundations/business-units/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ locals {

module "shared-folder" {
source = "terraform-google-modules/folders/google"
version = "2.0.0"
version = "2.0.2"
parent = var.root_node
names = ["shared"]
}
Expand All @@ -53,7 +53,7 @@ module "project-tf" {

module "service-accounts-tf-environments" {
source = "terraform-google-modules/service-accounts/google"
version = "2.0.1"
version = "2.0.2"
project_id = module.project-tf.project_id
org_id = var.organization_id
billing_account_id = var.billing_account_id
Expand Down Expand Up @@ -151,7 +151,7 @@ module "project-audit" {

module "bq-audit-export" {
source = "terraform-google-modules/log-export/google//modules/bigquery"
version = "3.1.0"
version = "3.2.0"
project_id = module.project-audit.project_id
dataset_name = "${replace(local.log_sink_name, "-", "_")}"
log_sink_writer_identity = module.log-sink-audit.writer_identity
Expand All @@ -161,7 +161,7 @@ module "bq-audit-export" {

module "log-sink-audit" {
source = "terraform-google-modules/log-export/google"
version = "3.1.0"
version = "3.2.0"
filter = "logName: \"/logs/cloudaudit.googleapis.com%2Factivity\" OR logName: \"/logs/cloudaudit.googleapis.com%2Fsystem_event\""
log_sink_name = local.log_sink_name
parent_resource_type = local.log_sink_parent_resource_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

module "business-unit-folder" {
source = "terraform-google-modules/folders/google"
version = "2.0.0"
version = "2.0.2"
parent = var.root_node
names = [var.business_unit_folder_name]
}
Expand All @@ -29,7 +29,7 @@ module "business-unit-folder" {

module "environment-folders" {
source = "terraform-google-modules/folders/google"
version = "2.0.0"
version = "2.0.2"
parent = module.business-unit-folder.id
names = var.environments
set_roles = true
Expand All @@ -41,4 +41,4 @@ module "environment-folders" {
"roles/compute.networkAdmin",
"roles/compute.xpnAdmin"
]
}
}
7 changes: 7 additions & 0 deletions foundations/business-units/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

variable "audit_viewers" {
description = "Audit project viewers, in IAM format."
type = list(string)
default = []
}

Expand Down Expand Up @@ -44,11 +45,13 @@ variable "environments" {

variable "generate_service_account_keys" {
description = "Generate and store service account keys in the state file."
type = bool
default = false
}

variable "gcs_location" {
description = "GCS bucket location."
type = string
default = "EU"
}

Expand All @@ -70,21 +73,25 @@ variable "root_node" {
variable "shared_bindings_members" {
description = "List of comma-delimited IAM-format members for the additional shared project bindings."
# example: ["user:[email protected],[email protected]", "user:[email protected]"]
type = list(string)
default = []
}
variable "shared_bindings_roles" {
description = "List of roles for additional shared project bindings."
# example: ["roles/storage.objectViewer", "roles/storage.admin"]
type = list(string)
default = []
}

variable "terraform_owners" {
description = "Terraform project owners, in IAM format."
type = list(string)
default = []
}

variable "project_services" {
description = "Service APIs enabled by default in new projects."
type = list(string)
default = [
"resourceviews.googleapis.com",
"stackdriver.googleapis.com",
Expand Down
63 changes: 31 additions & 32 deletions foundations/environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,37 @@ For more complex setups where multiple shared services projects are needed to en

If no shared services are needed, the shared service project module can of course be removed from `main.tf`.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| audit\_viewers | Audit project viewers, in IAM format. | list | `<list>` | no |
| billing\_account\_id | Billing account id used as default for new projects. | string | n/a | yes |
| environments | Environment short names. | list(string) | n/a | yes |
| gcs\_location | GCS bucket location. | string | `"EU"` | no |
| generate\_service\_account\_keys | Generate and store service account keys in the state file. | string | `"false"` | no |
| grant\_xpn\_folder\_roles | Grant roles needed for Shared VPC creation to service accounts at the environment folder level. | string | `"true"` | no |
| grant\_xpn\_org\_roles | Grant roles needed for Shared VPC creation to service accounts at the organization level. | string | `"false"` | no |
| organization\_id | Organization id. | string | n/a | yes |
| prefix | Prefix used for resources that need unique names. | string | n/a | yes |
| project\_services | Service APIs enabled by default in new projects. | list | `<list>` | no |
| root\_node | Root node for the new hierarchy, either 'organizations/org_id' or 'folders/folder_id'. | string | n/a | yes |
| shared\_bindings\_members | List of comma-delimited IAM-format members for the additional shared project bindings. | list | `<list>` | no |
| shared\_bindings\_roles | List of roles for additional shared project bindings. | list | `<list>` | no |
| terraform\_owners | Terraform project owners, in IAM format. | list | `<list>` | no |
<!-- BEGIN TFDOC -->
## Variables

| name | description | type | required | default |
|---|---|:---: |:---:|:---:|
| billing_account_id | Billing account id used as default for new projects. | <code title="">string</code> | ✓ | |
| environments | Environment short names. | <code title="list&#40;string&#41;">list(string)</code> | | |
| organization_id | Organization id. | <code title="">string</code> | | |
| prefix | Prefix used for resources that need unique names. | <code title="">string</code> | | |
| root_node | Root node for the new hierarchy, either 'organizations/org_id' or 'folders/folder_id'. | <code title="">string</code> | | |
| *audit_viewers* | Audit project viewers, in IAM format. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *gcs_location* | GCS bucket location. | <code title="">string</code> | | <code title="">EU</code> |
| *generate_service_account_keys* | Generate and store service account keys in the state file. | <code title="">bool</code> | | <code title="">false</code> |
| *grant_xpn_folder_roles* | Grant roles needed for Shared VPC creation to service accounts at the environment folder level. | <code title="">bool</code> | | <code title="">true</code> |
| *grant_xpn_org_roles* | Grant roles needed for Shared VPC creation to service accounts at the organization level. | <code title="">bool</code> | | <code title="">false</code> |
| *project_services* | Service APIs enabled by default in new projects. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="&#91;&#10;&#34;resourceviews.googleapis.com&#34;,&#10;&#34;stackdriver.googleapis.com&#34;,&#10;&#93;">...</code> |
| *shared_bindings_members* | List of comma-delimited IAM-format members for the additional shared project bindings. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *shared_bindings_roles* | List of roles for additional shared project bindings. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *terraform_owners* | Terraform project owners, in IAM format. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |

## Outputs

| Name | Description |
|------|-------------|
| audit\_logs\_bq\_dataset | Bigquery dataset for the audit logs export. |
| audit\_logs\_project | Project that holds the audit logs export resources. |
| bootstrap\_tf\_gcs\_bucket | GCS bucket used for the bootstrap Terraform state. |
| environment\_folders | Top-level environment folders. |
| environment\_service\_account\_keys | Service account keys used to run each environment Terraform modules. |
| environment\_service\_accounts | Service accounts used to run each environment Terraform modules. |
| environment\_tf\_gcs\_buckets | GCS buckets used for each environment Terraform state. |
| shared\_resources\_project | Project that holdes resources shared across environments. |
| terraform\_project | Project that holds the base Terraform resources. |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
| name | description | sensitive |
|---|---|:---:|
| audit_logs_bq_dataset | Bigquery dataset for the audit logs export. | |
| audit_logs_project | Project that holds the audit logs export resources. | |
| bootstrap_tf_gcs_bucket | GCS bucket used for the bootstrap Terraform state. | |
| environment_folders | Top-level environment folders. | |
| environment_service_account_keys | Service account keys used to run each environment Terraform modules. | ✓ |
| environment_service_accounts | Service accounts used to run each environment Terraform modules. | |
| environment_tf_gcs_buckets | GCS buckets used for each environment Terraform state. | |
| shared_resources_project | Project that holdes resources shared across environments. | |
| terraform_project | Project that holds the base Terraform resources. | |
<!-- END TFDOC -->
38 changes: 38 additions & 0 deletions foundations/environments/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

locals {
folder_roles = concat(var.iam_folder_roles, local.sa_xpn_folder_role)
sa_billing_account_role = (
var.iam_billing_config.target_org ? [] : ["roles/billing.user"]
)
sa_billing_org_role = (
! var.iam_billing_config.target_org ? [] : ["roles/billing.user"]
)
sa_xpn_folder_role = (
local.sa_xpn_target_org ? [] : ["roles/compute.xpnAdmin"]
)
sa_xpn_org_roles = (
local.sa_xpn_target_org
? ["roles/compute.xpnAdmin", "roles/resourcemanager.organizationViewer"]
: ["roles/resourcemanager.organizationViewer"]
)
sa_xpn_target_org = (
var.iam_xpn_config.target_org
||
substr(var.root_node, 0, 13) == "organizations"
)
}
Loading