Skip to content

Commit a534603

Browse files
feat: Add option for skipping the gcloud CLI download (#393)
Co-authored-by: Josef Reinhard Brandl <[email protected]>
1 parent d3bd3ee commit a534603

File tree

11 files changed

+37
-0
lines changed

11 files changed

+37
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Extending the adopted spec, each change should have a link to its corresponding
2323

2424
## [Unreleased]
2525

26+
- Added `skip_gcloud_download` option which can be used to skip downloading the gcloud CLI if it is already installed
27+
2628
## [7.0.0] - 2020-01-15
2729

2830
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ determining that location is as follows:
144144
| sa\_role | A role to give the default Service Account for the project (defaults to none) | string | `""` | no |
145145
| shared\_vpc | The ID of the host project which hosts the shared VPC | string | `""` | no |
146146
| shared\_vpc\_subnets | List of subnets fully qualified subnet IDs (ie. projects/$project_id/regions/$region/subnetworks/$subnet_id) | list(string) | `<list>` | no |
147+
| skip\_gcloud\_download | Whether to skip downloading gcloud (assumes gcloud is already available outside the module) | bool | `"false"` | no |
147148
| usage\_bucket\_name | Name of a GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
148149
| usage\_bucket\_prefix | Prefix in the GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
149150
| use\_tf\_google\_credentials\_env\_var | Use GOOGLE_CREDENTIALS environment variable to run gcloud auth activate-service-account with. | bool | `"false"` | no |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ module "project-factory" {
5858
python_interpreter_path = var.python_interpreter_path
5959
pip_executable_path = var.pip_executable_path
6060
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
61+
skip_gcloud_download = var.skip_gcloud_download
6162
}
6263

6364
/******************************************

modules/core_project_factory/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ module "gcloud_delete" {
163163
enabled = var.default_service_account == "delete"
164164
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
165165

166+
skip_download = var.skip_gcloud_download
167+
166168
create_cmd_entrypoint = "${path.module}/scripts/modify-service-account.sh"
167169
create_cmd_body = <<-EOT
168170
--project_id='${google_project.main.project_id}' \
@@ -189,6 +191,8 @@ module "gcloud_deprivilege" {
189191
enabled = var.default_service_account == "deprivilege"
190192
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
191193

194+
skip_download = var.skip_gcloud_download
195+
192196
create_cmd_entrypoint = "${path.module}/scripts/modify-service-account.sh"
193197
create_cmd_body = <<-EOT
194198
--project_id='${google_project.main.project_id}' \
@@ -215,6 +219,8 @@ module "gcloud_disable" {
215219
enabled = var.default_service_account == "disable"
216220
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
217221

222+
skip_download = var.skip_gcloud_download
223+
218224
create_cmd_entrypoint = "${path.module}/scripts/modify-service-account.sh"
219225
create_cmd_body = <<-EOT
220226
--project_id='${google_project.main.project_id}' \

modules/core_project_factory/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,9 @@ variable "use_tf_google_credentials_env_var" {
189189
type = bool
190190
default = false
191191
}
192+
193+
variable "skip_gcloud_download" {
194+
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
195+
type = bool
196+
default = false
197+
}

modules/gsuite_enabled/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ The roles granted are specifically:
9090
| shared\_vpc | The ID of the host project which hosts the shared VPC | string | `""` | no |
9191
| shared\_vpc\_enabled | If shared VPC should be used | bool | `"false"` | no |
9292
| shared\_vpc\_subnets | List of subnets fully qualified subnet IDs (ie. projects/$project_id/regions/$region/subnetworks/$subnet_id) | list(string) | `<list>` | no |
93+
| skip\_gcloud\_download | Whether to skip downloading gcloud (assumes gcloud is already available outside the module) | bool | `"false"` | no |
9394
| usage\_bucket\_name | Name of a GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
9495
| usage\_bucket\_prefix | Prefix in the GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
9596
| use\_tf\_google\_credentials\_env\_var | Use GOOGLE_CREDENTIALS environment variable to run gcloud auth activate-service-account with. | bool | `"false"` | no |

modules/gsuite_enabled/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ module "project-factory" {
9999
disable_dependent_services = var.disable_dependent_services
100100
python_interpreter_path = var.python_interpreter_path
101101
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
102+
skip_gcloud_download = var.skip_gcloud_download
102103
}
103104

104105
/******************************************

modules/gsuite_enabled/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,9 @@ variable "use_tf_google_credentials_env_var" {
200200
type = bool
201201
default = false
202202
}
203+
204+
variable "skip_gcloud_download" {
205+
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
206+
type = bool
207+
default = false
208+
}

modules/shared_vpc/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ module "project-factory" {
5656
disable_dependent_services = var.disable_dependent_services
5757
python_interpreter_path = var.python_interpreter_path
5858
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
59+
skip_gcloud_download = var.skip_gcloud_download
5960
}
6061

6162
/******************************************

modules/shared_vpc/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,9 @@ variable "use_tf_google_credentials_env_var" {
194194
type = bool
195195
default = false
196196
}
197+
198+
variable "skip_gcloud_download" {
199+
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
200+
type = bool
201+
default = false
202+
}

0 commit comments

Comments
 (0)