Merge branch 'master' into example-wordpress

This commit is contained in:
Natalia Strelkova 2022-10-07 15:41:22 +02:00 committed by GitHub
commit 54290fb18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 436 additions and 458 deletions

View File

@ -37,7 +37,7 @@ jobs:
- name: Set up Terraform - name: Set up Terraform
uses: hashicorp/setup-terraform@v1 uses: hashicorp/setup-terraform@v1
with: with:
terraform_version: 1.3 terraform_version: 1.3.2
- name: Install dependencies - name: Install dependencies
run: | run: |

View File

@ -30,7 +30,7 @@ env:
PYTEST_ADDOPTS: "--color=yes" PYTEST_ADDOPTS: "--color=yes"
PYTHON_VERSION: "3.10" PYTHON_VERSION: "3.10"
TF_PLUGIN_CACHE_DIR: "/home/runner/.terraform.d/plugin-cache" TF_PLUGIN_CACHE_DIR: "/home/runner/.terraform.d/plugin-cache"
TF_VERSION: 1.3.0 TF_VERSION: 1.3.2
jobs: jobs:
doc-examples: doc-examples:
@ -48,10 +48,18 @@ jobs:
with: with:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false
# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions - name: Pin provider versions
run: | run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf for f in $(find . -name versions.tf); do
find -name versions.tf -exec cp default-versions.tf {} \; sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests on documentation examples - name: Run tests on documentation examples
id: pytest id: pytest
@ -76,15 +84,17 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Terraform - name: Set up Terraform
uses: hashicorp/setup-terraform@v1 uses: hashicorp/setup-terraform@v2
with: with:
terraform_version: ${{ env.TF_VERSION }} terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false terraform_wrapper: false
# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions - name: Pin provider versions
run: | run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf for f in $(find . -name versions.tf); do
find -name versions.tf -exec cp default-versions.tf {} \; sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests environments - name: Run tests environments
id: pytest id: pytest
@ -109,15 +119,17 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Terraform - name: Set up Terraform
uses: hashicorp/setup-terraform@v1 uses: hashicorp/setup-terraform@v2
with: with:
terraform_version: ${{ env.TF_VERSION }} terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false terraform_wrapper: false
# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions - name: Pin provider versions
run: | run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf for f in $(find . -name versions.tf); do
find -name versions.tf -exec cp default-versions.tf {} \; sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests modules - name: Run tests modules
id: pytest id: pytest
@ -142,15 +154,17 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Terraform - name: Set up Terraform
uses: hashicorp/setup-terraform@v1 uses: hashicorp/setup-terraform@v2
with: with:
terraform_version: ${{ env.TF_VERSION }} terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false terraform_wrapper: false
# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions - name: Pin provider versions
run: | run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf for f in $(find . -name versions.tf); do
find -name versions.tf -exec cp default-versions.tf {} \; sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests on FAST stages - name: Run tests on FAST stages
id: pytest id: pytest

170
FABRIC-AND-CFT.md Normal file
View File

@ -0,0 +1,170 @@
# Cloud Foundation Fabric and Cloud Foundation Toolkit
This page highlights the main differences (both technical and philosophical) between Cloud Foundation Fabric and Cloud Foundation Toolkit for end users and guide them in their decision making process for identifying the best suite of modules for their use cases.
## Cloud Foundation Fabric (a.k.a Fabric, this repo)
Fabric is a collection of Terraform modules and end to end examples meant to be cloned as a single unit and used as is for fast prototyping or decomposed and modified for usage in organizations.
## Cloud Foundation Toolkit (a.k.a CFT)
CFT is a collection of Terraform modules and examples with opinionated GCP best practices implemented as individual modules for gradual adoption and off the shelf usage in organizations.
## Third-party reviews
* [Google Cloud Landing Zone Comparison](https://www.meshcloud.io/2022/09/09/gcp-landing-zone-comparison/) by Meshcloud.
## Key Differences
<table>
<tr>
<td>
</td>
<td><strong>Fabric</strong>
</td>
<td><strong>CFT</strong>
</td>
</tr>
<tr>
<td><strong>Target User</strong>
</td>
<td>Organizations interested in forking, maintaining and customizing Terraform modules.
</td>
<td>Organizations interested in using opinionated, prebuilt Terraform modules.
</td>
</tr>
<tr>
<td><strong>Configuration</strong>
</td>
<td>Less opinionated allowing end users higher flexibility.
</td>
<td>Opinionated by default, end users may need to fork if it does not meet their use case.
</td>
</tr>
<tr>
<td><strong>Extensibility</strong>
</td>
<td>Built with extensibility in mind catering to fork and use patterns. Modules are often lightweight and easy to adopt / tailor to specific use cases.
</td>
<td>Not built with fork and use extensibility, caters to off the shelf consumption.
</td>
</tr>
<tr>
<td><strong>Config customization</strong>
</td>
<td>Prefer customization using variables via objects, tight variable space.
</td>
<td>Prefer customization using variables via primitives.
</td>
</tr>
<tr>
<td><strong>Examples</strong>
</td>
<td>Thorough examples for individual modules, and end to end examples composing multiple modules covering a wide variety of use cases from foundations to solutions.
</td>
<td>Examples for a module mostly focus on that individual module. \
\
Composition is often not shown in examples but in other modules built using smaller modules.
</td>
</tr>
<tr>
<td><strong>Resources</strong>
</td>
<td>Leaner modules wrapping resources.
</td>
<td>Heavier root modules that often compose leaner sub modules wrapping resources.
</td>
</tr>
<tr>
<td><strong>Resource grouping</strong>
</td>
<td>Generally grouped by logical entities.
</td>
<td>Generally grouped by products/product areas.
</td>
</tr>
<tr>
<td><strong>Release Cadence</strong>
</td>
<td>Modules versioned and released together.
</td>
<td>Modules versioned and released individually.
</td>
</tr>
<tr>
<td><strong>Individual module usage</strong>
</td>
<td>Individual modules consumed directly using Git as a module source.
<p>
For production usage, we encourage customers to “fork and own” their own repository.
</td>
<td>Individual repositories consumed via the Terraform registry.
<p>
For production/airgapped usage, customers may also mirror modules to a private registry.
</td>
</tr>
<tr>
<td><strong>Factories</strong>
</td>
<td>Fabric implements several "factories" in modules, where users can drive or automate Terraform via YAML files (projects, subnetworks, firewalls, etc.).
</td>
<td>
</td>
</tr>
<tr>
<td><strong>Organizational adoption</strong>
</td>
<td>Mono repo cloned into an organizational VCS (or catalog) and separated into individual modules for internal consumption.
</td>
<td>Individual repos forked (for air gap) or wrapping upstream sources to create individual modules for internal consumption.
</td>
</tr>
<tr>
<td><strong>Distribution</strong>
</td>
<td>Distributed via Git/GitHub.
</td>
<td>Distributed via Git/GitHub and Terraform Registry.
</td>
</tr>
<tr>
<td><strong>Testing</strong>
</td>
<td>Every PR performs unit tests on modules, examples, and documentation snippets by evaluating a Terraform plan via Python <a href="https://pypi.org/project/tftest/">tftest</a> library.
</td>
<td>Every PR performs full end-to-end deployment with integration tests using the blueprint test framework.
</td>
</tr>
</table>
## Similarities
* Both collections of modules are designed with stable interfaces that work well together with other modules in their ecosystem.
* Both collections of modules require minimal variables and provide defaults.
* Both collections of modules are well tested and documented with information about usage, code snippets and provide information about variables and outputs.
## Should you choose Fabric or CFT?
> You/Your organization is knowledgeable in Terraform and interested in forking and owning a collection of modules.
Fabric is a better choice as it bootstraps you with a collection of modules out of the box that can be customized exactly to fit your organization needs.
> You/Your organization is getting started with Terraform and interested in GCP best practices out of the box.
CFT is a better choice as it allows you to directly reference specific modules from the registry and provide opinionated configuration by default.
> You/Your organization is looking to rapidly prototype some functionality on GCP.
Fabric is a better choice. Being a mono repo it allows you to get started quickly with all your source code in one place for easier debugging.
> You/Your organization has existing infrastructure and processes but want to start adopting IaC gradually.
CFT is designed to be modular and off the shelf, providing higher level abstractions to product groups which allows certain teams to adopt Terraform without maintenance burden while allowing others to follow existing practices.
## Using Fabric and CFT together
Even with all the above points, it may be hard to make a decision. While the modules may have different patterns and philosophies, it is often possible to bring the best of both worlds together. Here are some tips to follow:
* Since modules work well together within their ecosystem, select logical boundaries for using Fabric or CFT. For example use CFT for deploying resources within projects but use Fabric for managing project creation and IAM.
* Use strengths of each collection of modules to your advantage. Empower application teams to define their infrastructure as code using off the shelf CFT modules. Using Fabric, bootstrap your platform team with a collection of tailor built modules for your organization.
* Lean into module composition and dependency inversion that both Fabric and CFT modules follow. For example, you can create a GKE cluster using either [Fabric](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/tree/master/modules/gke-cluster#gke-cluster-module) or [CFT](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine) GKE module and then use either [Fabric](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/tree/master/modules/gke-hub#variables) or [CFT](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/modules/fleet-membership) for setting up GKE Hub by passing in outputs from the GKE module.

View File

@ -13,7 +13,7 @@ This repository provides **end-to-end blueprints** and a **suite of Terraform mo
- reference [blueprints](./blueprints/) used to deep dive on network patterns or product features - reference [blueprints](./blueprints/) used to deep dive on network patterns or product features
- a comprehensive source of lean [modules](./modules/dns) that lend themselves well to changes - a comprehensive source of lean [modules](./modules/dns) that lend themselves well to changes
The whole repository is meant to be cloned as a single unit, and then forked into separate owned repositories to seed production usage, or used as-is and periodically updated as a complete toolkit for prototyping. You can read more on this approach in our [contributing guide](./CONTRIBUTING.md). The whole repository is meant to be cloned as a single unit, and then forked into separate owned repositories to seed production usage, or used as-is and periodically updated as a complete toolkit for prototyping. You can read more on this approach in our [contributing guide](./CONTRIBUTING.md), and a comparison against similar toolkits [here](./FABRIC-AND-CFT.md).
## Organization blueprint (Fabric FAST) ## Organization blueprint (Fabric FAST)

View File

@ -69,8 +69,6 @@ module "server" {
network_interfaces = [{ network_interfaces = [{
network = var.network_config == null ? module.vpc[0].self_link : var.network_config.network network = var.network_config == null ? module.vpc[0].self_link : var.network_config.network
subnetwork = var.network_config == null ? module.vpc[0].subnet_self_links["${var.region}/subnet"] : var.network_config.subnet subnetwork = var.network_config == null ? module.vpc[0].subnet_self_links["${var.region}/subnet"] : var.network_config.subnet
nat = false
addresses = null
}] }]
metadata = { metadata = {
# Enables OpenSSH in the Windows instance # Enables OpenSSH in the Windows instance

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -104,8 +104,6 @@ module "simple-vm-example" {
network_interfaces = [{ network_interfaces = [{
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = try(module.vpc.subnet_self_links["${var.region}/${var.name}-default"], "") subnetwork = try(module.vpc.subnet_self_links["${var.region}/${var.name}-default"], "")
nat = false
addresses = null
}] }]
tags = ["${var.project_id}-test-feed", "shared-test-feed"] tags = ["${var.project_id}-test-feed", "shared-test-feed"]
} }

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -94,13 +94,9 @@ module "instance_template_ew1" {
network_interfaces = [{ network_interfaces = [{
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["europe-west1/subnet-ew1"] subnetwork = module.vpc.subnet_self_links["europe-west1/subnet-ew1"]
nat = false
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "projects/debian-cloud/global/images/family/debian-11" image = "projects/debian-cloud/global/images/family/debian-11"
type = "pd-ssd"
size = 10
} }
metadata = { metadata = {
startup-script-url = "gs://cloud-training/gcpnet/httplb/startup.sh" startup-script-url = "gs://cloud-training/gcpnet/httplb/startup.sh"
@ -119,13 +115,9 @@ module "instance_template_ue1" {
network_interfaces = [{ network_interfaces = [{
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["us-east1/subnet-ue1"] subnetwork = module.vpc.subnet_self_links["us-east1/subnet-ue1"]
nat = false
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "projects/debian-cloud/global/images/family/debian-11" image = "projects/debian-cloud/global/images/family/debian-11"
type = "pd-ssd"
size = 10
} }
metadata = { metadata = {
startup-script-url = "gs://cloud-training/gcpnet/httplb/startup.sh" startup-script-url = "gs://cloud-training/gcpnet/httplb/startup.sh"
@ -146,12 +138,9 @@ module "vm_siege" {
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["us-west1/subnet-uw1"] subnetwork = module.vpc.subnet_self_links["us-west1/subnet-uw1"]
nat = true nat = true
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "projects/debian-cloud/global/images/family/debian-11" image = "projects/debian-cloud/global/images/family/debian-11"
type = "pd-ssd"
size = 10
} }
metadata = { metadata = {
startup-script = <<EOT startup-script = <<EOT

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -155,13 +155,9 @@ module "squid-vm" {
network_interfaces = [{ network_interfaces = [{
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["${var.region}/proxy"] subnetwork = module.vpc.subnet_self_links["${var.region}/proxy"]
nat = false
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "cos-cloud/cos-stable" image = "cos-cloud/cos-stable"
type = "pd-standard"
size = 10
} }
service_account = module.service-account-squid.email service_account = module.service-account-squid.email
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"] service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -33,8 +33,6 @@ module "vm-left" {
{ {
network = module.vpc-left.self_link network = module.vpc-left.self_link
subnetwork = values(module.vpc-left.subnet_self_links)[0] subnetwork = values(module.vpc-left.subnet_self_links)[0]
nat = false
addresses = null
} }
] ]
tags = ["ssh"] tags = ["ssh"]
@ -58,8 +56,6 @@ module "vm-right" {
{ {
network = module.vpc-right.self_link network = module.vpc-right.self_link
subnetwork = values(module.vpc-right.subnet_self_links)[0] subnetwork = values(module.vpc-right.subnet_self_links)[0]
nat = false
addresses = null
} }
] ]
tags = ["ssh"] tags = ["ssh"]

View File

@ -20,7 +20,7 @@ locals {
Description=Start monitoring agent container Description=Start monitoring agent container
After=gcr-online.target docker.socket After=gcr-online.target docker.socket
Wants=gcr-online.target docker.socket docker-events-collector.service Wants=gcr-online.target docker.socket docker-events-collector.service
[Service] [Service]
Environment="HOME=/home/opsagent" Environment="HOME=/home/opsagent"
ExecStartPre=/usr/bin/docker-credential-gcr configure-docker ExecStartPre=/usr/bin/docker-credential-gcr configure-docker
@ -35,7 +35,7 @@ locals {
logging: logging:
service: service:
pipelines: pipelines:
default_pipeline: default_pipeline:
receivers: [] receivers: []
metrics: metrics:
receivers: receivers:
@ -227,42 +227,34 @@ module "service-account-proxy" {
} }
module "cos-nginx" { module "cos-nginx" {
count = !var.tls ? 1 : 0 count = !var.tls ? 1 : 0
source = "../../../modules/cloud-config-container/nginx" source = "../../../modules/cloud-config-container/nginx"
image = var.nginx_image
image = var.nginx_image files = local.nginx_files
files = local.nginx_files users = local.users
users = local.users
runcmd_pre = ["sed -i \"s/HOSTNAME/$${HOSTNAME}/\" /etc/nginx/conf.d/default.conf"] runcmd_pre = ["sed -i \"s/HOSTNAME/$${HOSTNAME}/\" /etc/nginx/conf.d/default.conf"]
runcmd_post = ["systemctl start monitoring-agent"] runcmd_post = ["systemctl start monitoring-agent"]
} }
module "cos-nginx-tls" { module "cos-nginx-tls" {
count = var.tls ? 1 : 0 count = var.tls ? 1 : 0
source = "../../../modules/cloud-config-container/nginx-tls" source = "../../../modules/cloud-config-container/nginx-tls"
nginx_image = var.nginx_image nginx_image = var.nginx_image
files = local.nginx_files files = local.nginx_files
users = local.users users = local.users
runcmd_post = ["systemctl start monitoring-agent"] runcmd_post = ["systemctl start monitoring-agent"]
} }
module "mig-proxy" { module "mig-proxy" {
source = "../../../modules/compute-mig" source = "../../../modules/compute-mig"
project_id = module.project.project_id project_id = module.project.project_id
location = var.region
location = var.region regional = true
regional = true name = format("%sproxy-cluster", var.prefix)
name = format("%sproxy-cluster", var.prefix)
named_ports = { named_ports = {
http = "80" http = "80"
https = "443" https = "443"
} }
autoscaler_config = var.autoscaling == null ? null : { autoscaler_config = var.autoscaling == null ? null : {
min_replicas = var.autoscaling.min_replicas min_replicas = var.autoscaling.min_replicas
max_replicas = var.autoscaling.max_replicas max_replicas = var.autoscaling.max_replicas
@ -271,7 +263,6 @@ module "mig-proxy" {
load_balancing_utilization_target = null load_balancing_utilization_target = null
metric = var.autoscaling_metric metric = var.autoscaling_metric
} }
update_policy = { update_policy = {
type = "PROACTIVE" type = "PROACTIVE"
minimal_action = "REPLACE" minimal_action = "REPLACE"
@ -281,12 +272,10 @@ module "mig-proxy" {
max_unavailable_type = null max_unavailable_type = null
max_unavailable = null max_unavailable = null
} }
default_version = { default_version = {
instance_template = module.proxy-vm.template.self_link instance_template = module.proxy-vm.template.self_link
name = "proxy-vm" name = "proxy-vm"
} }
health_check_config = { health_check_config = {
type = "http" type = "http"
check = { check = {
@ -308,45 +297,32 @@ module "mig-proxy" {
} }
module "proxy-vm" { module "proxy-vm" {
source = "../../../modules/compute-vm" source = "../../../modules/compute-vm"
project_id = module.project.project_id
project_id = module.project.project_id zone = format("%s-c", var.region)
name = "nginx-test-vm"
zone = format("%s-c", var.region)
name = "nginx-test-vm"
instance_type = "e2-standard-2" instance_type = "e2-standard-2"
tags = ["proxy-cluster"]
tags = ["proxy-cluster"]
network_interfaces = [{ network_interfaces = [{
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links[format("%s/%s", var.region, var.subnetwork)] subnetwork = module.vpc.subnet_self_links[format("%s/%s", var.region, var.subnetwork)]
nat = false
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "projects/cos-cloud/global/images/family/cos-stable" image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
} }
create_template = true create_template = true
metadata = { metadata = {
user-data = !var.tls ? module.cos-nginx.0.cloud_config : module.cos-nginx-tls.0.cloud_config user-data = !var.tls ? module.cos-nginx.0.cloud_config : module.cos-nginx-tls.0.cloud_config
} }
service_account = module.service-account-proxy.email service_account = module.service-account-proxy.email
service_account_create = false service_account_create = false
} }
module "xlb" { module "xlb" {
source = "../../../modules/net-glb" source = "../../../modules/net-glb"
name = format("%sreverse-proxy-xlb", var.prefix) name = format("%sreverse-proxy-xlb", var.prefix)
project_id = module.project.project_id project_id = module.project.project_id
reserve_ip_address = true reserve_ip_address = true
health_checks_config = { health_checks_config = {
format("%sreverse-proxy-hc", var.prefix) = { format("%sreverse-proxy-hc", var.prefix) = {
type = "http" type = "http"
@ -364,13 +340,11 @@ module "xlb" {
} }
} }
} }
backend_services_config = { backend_services_config = {
format("%sreverse-proxy-backend", var.prefix) = { format("%sreverse-proxy-backend", var.prefix) = {
bucket_config = null bucket_config = null
enable_cdn = false enable_cdn = false
cdn_config = null cdn_config = null
group_config = { group_config = {
backends = [ backends = [
{ {
@ -378,7 +352,6 @@ module "xlb" {
options = null options = null
} }
] ]
health_checks = [format("%sreverse-proxy-hc", var.prefix)] health_checks = [format("%sreverse-proxy-hc", var.prefix)]
log_config = null log_config = null
options = { options = {

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -237,8 +237,6 @@ module "vm-test1" {
network_interfaces = [{ network_interfaces = [{
network = module.vpc.self_link network = module.vpc.self_link
subnetwork = module.vpc.subnet_self_links["${var.region.gcp1}/subnet1"] subnetwork = module.vpc.subnet_self_links["${var.region.gcp1}/subnet1"]
nat = false
addresses = null
}] }]
metadata = { startup-script = local.vm-startup-script } metadata = { startup-script = local.vm-startup-script }
service_account = module.service-account-gce.email service_account = module.service-account-gce.email
@ -312,8 +310,6 @@ module "vm-onprem" {
name = "onprem" name = "onprem"
boot_disk = { boot_disk = {
image = "ubuntu-os-cloud/ubuntu-1804-lts" image = "ubuntu-os-cloud/ubuntu-1804-lts"
type = "pd-ssd"
size = 10
} }
metadata = { metadata = {
user-data = module.config-onprem.cloud_config user-data = module.config-onprem.cloud_config
@ -321,8 +317,6 @@ module "vm-onprem" {
network_interfaces = [{ network_interfaces = [{
network = module.vpc.name network = module.vpc.name
subnetwork = module.vpc.subnet_self_links["${var.region.gcp1}/subnet1"] subnetwork = module.vpc.subnet_self_links["${var.region.gcp1}/subnet1"]
nat = true
addresses = null
}] }]
service_account = module.service-account-onprem.email service_account = module.service-account-onprem.email
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"] service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -178,12 +178,8 @@ module "test-vm" {
instance_type = "e2-micro" instance_type = "e2-micro"
boot_disk = { boot_disk = {
image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2104" image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2104"
type = "pd-balanced"
size = 10
} }
network_interfaces = [{ network_interfaces = [{
addresses = null
nat = false
network = module.vpc-onprem.self_link network = module.vpc-onprem.self_link
subnetwork = module.vpc-onprem.subnet_self_links["${var.region}/${var.name}-onprem"] subnetwork = module.vpc-onprem.subnet_self_links["${var.region}/${var.name}-onprem"]
}] }]

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"
@ -33,5 +33,3 @@ terraform {
version = ">= 3.16.1" version = ">= 3.16.1"
} }
} }

View File

@ -38,28 +38,20 @@ module "nva-template-ew1" {
{ {
network = module.landing-untrusted-vpc.self_link network = module.landing-untrusted-vpc.self_link
subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west1/landing-untrusted-default-ew1"] subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west1/landing-untrusted-default-ew1"]
nat = false
addresses = null
}, },
{ {
network = module.landing-trusted-vpc.self_link network = module.landing-trusted-vpc.self_link
subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west1/landing-trusted-default-ew1"] subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west1/landing-trusted-default-ew1"]
nat = false
addresses = null
} }
] ]
boot_disk = { boot_disk = {
image = "projects/debian-cloud/global/images/family/debian-10" image = "projects/debian-cloud/global/images/family/debian-10"
type = "pd-balanced"
size = 10
} }
create_template = true create_template = true
instance_type = "f1-micro" instance_type = "f1-micro"
options = { options = {
allow_stopping_for_update = true spot = true
deletion_protection = false termination_action = "STOP"
spot = true
termination_action = "STOP"
} }
metadata = { metadata = {
startup-script = templatefile( startup-script = templatefile(

View File

@ -26,20 +26,13 @@
# network_interfaces = [{ # network_interfaces = [{
# network = module.landing-untrusted-vpc.self_link # network = module.landing-untrusted-vpc.self_link
# subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west1/landing-untrusted-default-ew1"] # subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west1/landing-untrusted-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew1", "ssh"] # tags = ["ew1", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -59,20 +52,13 @@
# network_interfaces = [{ # network_interfaces = [{
# network = module.landing-untrusted-vpc.self_link # network = module.landing-untrusted-vpc.self_link
# subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west4/landing-untrusted-default-ew4"] # subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west4/landing-untrusted-default-ew4"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew4", "ssh"] # tags = ["ew4", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -94,22 +80,15 @@
# network_interfaces = [{ # network_interfaces = [{
# network = module.landing-trusted-vpc.self_link # network = module.landing-trusted-vpc.self_link
# subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west1/landing-trusted-default-ew1"] # subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west1/landing-trusted-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew1", "ssh"] # tags = ["ew1", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
# metadata = { # metadata = {
# startup-script = <<EOF # startup-script = <<EOF
@ -127,20 +106,13 @@
# network_interfaces = [{ # network_interfaces = [{
# network = module.landing-trusted-vpc.self_link # network = module.landing-trusted-vpc.self_link
# subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west4/landing-trusted-default-ew4"] # subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west4/landing-trusted-default-ew4"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew4", "ssh"] # tags = ["ew4", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -163,20 +135,13 @@
# network = module.dev-spoke-vpc.self_link # network = module.dev-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west1/dev-default-ew1"] # subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west1/dev-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew1", "ssh"] # tags = ["ew1", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -197,20 +162,13 @@
# network = module.dev-spoke-vpc.self_link # network = module.dev-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west4/dev-default-ew4"] # subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west4/dev-default-ew4"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew4", "ssh"] # tags = ["ew4", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -233,9 +191,6 @@
# network = module.prod-spoke-vpc.self_link # network = module.prod-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west1/prod-default-ew1"] # subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west1/prod-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew1", "ssh"] # tags = ["ew1", "ssh"]
# service_account_create = true # service_account_create = true
@ -245,8 +200,6 @@
# size = 10 # size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -267,20 +220,13 @@
# network = module.prod-spoke-vpc.self_link # network = module.prod-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west4/prod-default-ew4"] # subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west4/prod-default-ew4"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ew4", "ssh"] # tags = ["ew4", "ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }

View File

@ -24,20 +24,13 @@
# network_interfaces = [{ # network_interfaces = [{
# network = module.landing-vpc.self_link # network = module.landing-vpc.self_link
# subnetwork = module.landing-vpc.subnet_self_links["europe-west1/landing-default-ew1"] # subnetwork = module.landing-vpc.subnet_self_links["europe-west1/landing-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ssh"] # tags = ["ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -58,20 +51,13 @@
# network = module.dev-spoke-vpc.self_link # network = module.dev-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west1/dev-default-ew1"] # subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west1/dev-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ssh"] # tags = ["ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -92,20 +78,13 @@
# network = module.prod-spoke-vpc.self_link # network = module.prod-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west1/prod-default-ew1"] # subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west1/prod-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ssh"] # tags = ["ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }

View File

@ -24,20 +24,13 @@
# network_interfaces = [{ # network_interfaces = [{
# network = module.landing-vpc.self_link # network = module.landing-vpc.self_link
# subnetwork = module.landing-vpc.subnet_self_links["europe-west1/landing-default-ew1"] # subnetwork = module.landing-vpc.subnet_self_links["europe-west1/landing-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ssh"] # tags = ["ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -58,20 +51,13 @@
# network = module.dev-spoke-vpc.self_link # network = module.dev-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west1/dev-default-ew1"] # subnetwork = module.dev-spoke-vpc.subnet_self_links["europe-west1/dev-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ssh"] # tags = ["ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }
@ -92,20 +78,13 @@
# network = module.prod-spoke-vpc.self_link # network = module.prod-spoke-vpc.self_link
# # change the subnet name to match the values you are actually using # # change the subnet name to match the values you are actually using
# subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west1/prod-default-ew1"] # subnetwork = module.prod-spoke-vpc.subnet_self_links["europe-west1/prod-default-ew1"]
# alias_ips = {}
# nat = false
# addresses = null
# }] # }]
# tags = ["ssh"] # tags = ["ssh"]
# service_account_create = true # service_account_create = true
# boot_disk = { # boot_disk = {
# image = "projects/debian-cloud/global/images/family/debian-10" # image = "projects/debian-cloud/global/images/family/debian-10"
# type = "pd-balanced"
# size = 10
# } # }
# options = { # options = {
# allow_stopping_for_update = true
# deletion_protection = false
# spot = true # spot = true
# termination_action = "STOP" # termination_action = "STOP"
# } # }

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -22,8 +22,6 @@ module "simple-vm-example" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
service_account_create = true service_account_create = true
} }
@ -42,16 +40,12 @@ module "spot-vm-example" {
zone = "europe-west1-b" zone = "europe-west1-b"
name = "test" name = "test"
options = { options = {
allow_stopping_for_update = true
deletion_protection = false
spot = true spot = true
termination_action = "STOP" termination_action = "STOP"
} }
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
service_account_create = true service_account_create = true
} }
@ -79,18 +73,14 @@ module "simple-vm-example" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
attached_disks = [{ attached_disks = [{
name = "repd-1" name = "repd-1"
size = null size = 10
source_type = "attach" source_type = "attach"
source = "regions/${var.region}/disks/repd-test-1" source = "regions/${var.region}/disks/repd-test-1"
options = { options = {
mode = null
replica_zone = "${var.region}-c" replica_zone = "${var.region}-c"
type = null
} }
}] }]
service_account_create = true service_account_create = true
@ -109,18 +99,14 @@ module "simple-vm-example" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
attached_disks = [{ attached_disks = [{
name = "repd" name = "repd"
size = null size = 10
source_type = "attach" source_type = "attach"
source = "https://www.googleapis.com/compute/v1/projects/${var.project_id}/regions/${var.region}/disks/repd-test-1" source = "https://www.googleapis.com/compute/v1/projects/${var.project_id}/regions/${var.region}/disks/repd-test-1"
options = { options = {
mode = null
replica_zone = "${var.region}-c" replica_zone = "${var.region}-c"
type = null
} }
}] }]
service_account_create = true service_account_create = true
@ -142,27 +128,19 @@ module "kms-vm-example" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
attached_disks = [ attached_disks = [
{ {
name = "attached-disk" name = "attached-disk"
size = 10 size = 10
source = null
source_type = null
options = null
} }
] ]
service_account_create = true service_account_create = true
boot_disk = { boot_disk = {
image = "projects/debian-cloud/global/images/family/debian-10" image = "projects/debian-cloud/global/images/family/debian-10"
type = "pd-ssd"
size = 10
} }
encryption = { encryption = {
encrypt_boot = true encrypt_boot = true
disk_encryption_key_raw = null
kms_key_self_link = var.kms_key.self_link kms_key_self_link = var.kms_key.self_link
} }
} }
@ -182,17 +160,10 @@ module "vm-with-alias-ips" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false alias_ips = {
addresses = null alias1 = "10.16.0.10/32"
}]
network_interface_options = {
0 = {
alias_ips = {
alias1 = "10.16.0.10/32"
}
nic_type = null
} }
} }]
service_account_create = true service_account_create = true
} }
# tftest modules=1 resources=2 # tftest modules=1 resources=2
@ -231,20 +202,12 @@ module "vm-with-gvnic" {
boot_disk = { boot_disk = {
image = google_compute_image.cos-gvnic.self_link image = google_compute_image.cos-gvnic.self_link
type = "pd-ssd" type = "pd-ssd"
size = 10
} }
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false nic_type = "GVNIC"
addresses = null
}] }]
network_interface_options = {
0 = {
alias_ips = null
nic_type = "GVNIC"
}
}
service_account_create = true service_account_create = true
} }
# tftest modules=1 resources=3 # tftest modules=1 resources=3
@ -263,21 +226,14 @@ module "cos-test" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "projects/cos-cloud/global/images/family/cos-stable" image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
} }
attached_disks = [ attached_disks = [
{ {
name = "disk-1" name = "disk-1"
size = 10 size = 10
source = null
source_type = null
options = null
} }
] ]
service_account = "vm-default@my-project.iam.gserviceaccount.com" service_account = "vm-default@my-project.iam.gserviceaccount.com"
@ -303,13 +259,9 @@ module "instance-group" {
network_interfaces = [{ network_interfaces = [{
network = var.vpc.self_link network = var.vpc.self_link
subnetwork = var.subnet.self_link subnetwork = var.subnet.self_link
nat = false
addresses = null
}] }]
boot_disk = { boot_disk = {
image = "projects/cos-cloud/global/images/family/cos-stable" image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
} }
service_account = var.service_account.email service_account = var.service_account.email
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"] service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
@ -326,36 +278,34 @@ module "instance-group" {
| name | description | type | required | default | | name | description | type | required | default |
|---|---|:---:|:---:|:---:| |---|---|:---:|:---:|:---:|
| [name](variables.tf#L160) | Instance name. | <code>string</code> | ✓ | | | [name](variables.tf#L163) | Instance name. | <code>string</code> | ✓ | |
| [network_interfaces](variables.tf#L174) | Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed. | <code title="list&#40;object&#40;&#123;&#10; nat &#61; bool&#10; network &#61; string&#10; subnetwork &#61; string&#10; addresses &#61; object&#40;&#123;&#10; internal &#61; string&#10; external &#61; string&#10; &#125;&#41;&#10;&#125;&#41;&#41;">list&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | ✓ | | | [network_interfaces](variables.tf#L168) | Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed. | <code title="list&#40;object&#40;&#123;&#10; nat &#61; optional&#40;bool, false&#41;&#10; network &#61; string&#10; subnetwork &#61; string&#10; addresses &#61; optional&#40;object&#40;&#123;&#10; internal &#61; string&#10; external &#61; string&#10; &#125;&#41;, null&#41;&#10; alias_ips &#61; optional&#40;map&#40;string&#41;, &#123;&#125;&#41;&#10; nic_type &#61; optional&#40;string&#41;&#10;&#125;&#41;&#41;">list&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | ✓ | |
| [project_id](variables.tf#L209) | Project id. | <code>string</code> | ✓ | | | [project_id](variables.tf#L205) | Project id. | <code>string</code> | ✓ | |
| [zone](variables.tf#L268) | Compute zone. | <code>string</code> | ✓ | | | [zone](variables.tf#L264) | Compute zone. | <code>string</code> | ✓ | |
| [attached_disk_defaults](variables.tf#L17) | Defaults for attached disks options. | <code title="object&#40;&#123;&#10; mode &#61; string&#10; replica_zone &#61; string&#10; type &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; auto_delete &#61; true&#10; mode &#61; &#34;READ_WRITE&#34;&#10; replica_zone &#61; null&#10; type &#61; &#34;pd-balanced&#34;&#10;&#125;">&#123;&#8230;&#125;</code> | | [attached_disk_defaults](variables.tf#L17) | Defaults for attached disks options. | <code title="object&#40;&#123;&#10; mode &#61; string&#10; replica_zone &#61; string&#10; type &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; mode &#61; &#34;READ_WRITE&#34;&#10; replica_zone &#61; null&#10; type &#61; &#34;pd-balanced&#34;&#10;&#125;">&#123;&#8230;&#125;</code> |
| [attached_disks](variables.tf#L32) | Additional disks, if options is null defaults will be used in its place. Source type is one of 'image' (zonal disks in vms and template), 'snapshot' (vm), 'existing', and null. | <code title="list&#40;object&#40;&#123;&#10; name &#61; string&#10; size &#61; string&#10; source &#61; string&#10; source_type &#61; string&#10; options &#61; object&#40;&#123;&#10; mode &#61; string&#10; replica_zone &#61; string&#10; type &#61; string&#10; &#125;&#41;&#10;&#125;&#41;&#41;">list&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#91;&#93;</code> | | [attached_disks](variables.tf#L31) | Additional disks, if options is null defaults will be used in its place. Source type is one of 'image' (zonal disks in vms and template), 'snapshot' (vm), 'existing', and null. | <code title="list&#40;object&#40;&#123;&#10; name &#61; string&#10; size &#61; string&#10; source &#61; optional&#40;string&#41;&#10; source_type &#61; optional&#40;string&#41;&#10; options &#61; optional&#40;&#10; object&#40;&#123;&#10; mode &#61; optional&#40;string, &#34;READ_WRITE&#34;&#41;&#10; replica_zone &#61; optional&#40;string&#41;&#10; type &#61; optional&#40;string, &#34;pd-balanced&#34;&#41;&#10; &#125;&#41;,&#10; &#123;&#10; mode &#61; &#34;READ_WRITE&#34;&#10; replica_zone &#61; null&#10; type &#61; &#34;pd-balanced&#34;&#10; &#125;&#10; &#41;&#10;&#125;&#41;&#41;">list&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#91;&#93;</code> |
| [boot_disk](variables.tf#L58) | Boot disk properties. | <code title="object&#40;&#123;&#10; image &#61; string&#10; size &#61; number&#10; type &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; image &#61; &#34;projects&#47;debian-cloud&#47;global&#47;images&#47;family&#47;debian-11&#34;&#10; type &#61; &#34;pd-balanced&#34;&#10; size &#61; 10&#10;&#125;">&#123;&#8230;&#125;</code> | | [boot_disk](variables.tf#L64) | Boot disk properties. | <code title="object&#40;&#123;&#10; auto_delete &#61; optional&#40;bool, true&#41;&#10; image &#61; optional&#40;string, &#34;projects&#47;debian-cloud&#47;global&#47;images&#47;family&#47;debian-11&#34;&#41;&#10; size &#61; optional&#40;number, 10&#41;&#10; type &#61; optional&#40;string, &#34;pd-balanced&#34;&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; auto_delete &#61; true&#10; image &#61; &#34;projects&#47;debian-cloud&#47;global&#47;images&#47;family&#47;debian-11&#34;&#10; type &#61; &#34;pd-balanced&#34;&#10; size &#61; 10&#10;&#125;">&#123;&#8230;&#125;</code> |
| [boot_disk_delete](variables.tf#L72) | Auto delete boot disk. | <code>bool</code> | | <code>true</code> | | [can_ip_forward](variables.tf#L80) | Enable IP forwarding. | <code>bool</code> | | <code>false</code> |
| [can_ip_forward](variables.tf#L78) | Enable IP forwarding. | <code>bool</code> | | <code>false</code> | | [confidential_compute](variables.tf#L86) | Enable Confidential Compute for these instances. | <code>bool</code> | | <code>false</code> |
| [confidential_compute](variables.tf#L84) | Enable Confidential Compute for these instances. | <code>bool</code> | | <code>false</code> | | [create_template](variables.tf#L92) | Create instance template instead of instances. | <code>bool</code> | | <code>false</code> |
| [create_template](variables.tf#L90) | Create instance template instead of instances. | <code>bool</code> | | <code>false</code> | | [description](variables.tf#L97) | Description of a Compute Instance. | <code>string</code> | | <code>&#34;Managed by the compute-vm Terraform module.&#34;</code> |
| [description](variables.tf#L95) | Description of a Compute Instance. | <code>string</code> | | <code>&#34;Managed by the compute-vm Terraform module.&#34;</code> | | [enable_display](variables.tf#L103) | Enable virtual display on the instances. | <code>bool</code> | | <code>false</code> |
| [enable_display](variables.tf#L100) | Enable virtual display on the instances. | <code>bool</code> | | <code>false</code> | | [encryption](variables.tf#L109) | Encryption options. Only one of kms_key_self_link and disk_encryption_key_raw may be set. If needed, you can specify to encrypt or not the boot disk. | <code title="object&#40;&#123;&#10; encrypt_boot &#61; optional&#40;bool, false&#41;&#10; disk_encryption_key_raw &#61; optional&#40;string&#41;&#10; kms_key_self_link &#61; optional&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [encryption](variables.tf#L106) | Encryption options. Only one of kms_key_self_link and disk_encryption_key_raw may be set. If needed, you can specify to encrypt or not the boot disk. | <code title="object&#40;&#123;&#10; encrypt_boot &#61; bool&#10; disk_encryption_key_raw &#61; string&#10; kms_key_self_link &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> | | [group](variables.tf#L119) | Define this variable to create an instance group for instances. Disabled for template use. | <code title="object&#40;&#123;&#10; named_ports &#61; map&#40;number&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [group](variables.tf#L116) | Define this variable to create an instance group for instances. Disabled for template use. | <code title="object&#40;&#123;&#10; named_ports &#61; map&#40;number&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> | | [hostname](variables.tf#L127) | Instance FQDN name. | <code>string</code> | | <code>null</code> |
| [hostname](variables.tf#L124) | Instance FQDN name. | <code>string</code> | | <code>null</code> | | [iam](variables.tf#L133) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map&#40;list&#40;string&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [iam](variables.tf#L130) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map&#40;list&#40;string&#41;&#41;</code> | | <code>&#123;&#125;</code> | | [instance_type](variables.tf#L139) | Instance type. | <code>string</code> | | <code>&#34;f1-micro&#34;</code> |
| [instance_type](variables.tf#L136) | Instance type. | <code>string</code> | | <code>&#34;f1-micro&#34;</code> | | [labels](variables.tf#L145) | Instance labels. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> |
| [labels](variables.tf#L142) | Instance labels. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | | [metadata](variables.tf#L151) | Instance metadata. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> |
| [metadata](variables.tf#L148) | Instance metadata. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | | [min_cpu_platform](variables.tf#L157) | Minimum CPU platform. | <code>string</code> | | <code>null</code> |
| [min_cpu_platform](variables.tf#L154) | Minimum CPU platform. | <code>string</code> | | <code>null</code> | | [options](variables.tf#L183) | Instance options. | <code title="object&#40;&#123;&#10; allow_stopping_for_update &#61; optional&#40;bool, true&#41;&#10; deletion_protection &#61; optional&#40;bool, false&#41;&#10; spot &#61; optional&#40;bool, false&#41;&#10; termination_action &#61; optional&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; allow_stopping_for_update &#61; true&#10; deletion_protection &#61; false&#10; spot &#61; false&#10; termination_action &#61; null&#10;&#125;">&#123;&#8230;&#125;</code> |
| [network_interface_options](variables.tf#L165) | Network interfaces extended options. The key is the index of the inteface to configure. The value is an object with alias_ips and nic_type. Set alias_ips or nic_type to null if you need only one of them. | <code title="map&#40;object&#40;&#123;&#10; alias_ips &#61; map&#40;string&#41;&#10; nic_type &#61; string&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | | [scratch_disks](variables.tf#L210) | Scratch disks configuration. | <code title="object&#40;&#123;&#10; count &#61; number&#10; interface &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; count &#61; 0&#10; interface &#61; &#34;NVME&#34;&#10;&#125;">&#123;&#8230;&#125;</code> |
| [options](variables.tf#L187) | Instance options. | <code title="object&#40;&#123;&#10; allow_stopping_for_update &#61; bool&#10; deletion_protection &#61; bool&#10; spot &#61; bool&#10; termination_action &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; allow_stopping_for_update &#61; true&#10; deletion_protection &#61; false&#10; spot &#61; false&#10; termination_action &#61; null&#10;&#125;">&#123;&#8230;&#125;</code> | | [service_account](variables.tf#L222) | Service account email. Unused if service account is auto-created. | <code>string</code> | | <code>null</code> |
| [scratch_disks](variables.tf#L214) | Scratch disks configuration. | <code title="object&#40;&#123;&#10; count &#61; number&#10; interface &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; count &#61; 0&#10; interface &#61; &#34;NVME&#34;&#10;&#125;">&#123;&#8230;&#125;</code> | | [service_account_create](variables.tf#L228) | Auto-create service account. | <code>bool</code> | | <code>false</code> |
| [service_account](variables.tf#L226) | Service account email. Unused if service account is auto-created. | <code>string</code> | | <code>null</code> | | [service_account_scopes](variables.tf#L236) | Scopes applied to service account. | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> |
| [service_account_create](variables.tf#L232) | Auto-create service account. | <code>bool</code> | | <code>false</code> | | [shielded_config](variables.tf#L242) | Shielded VM configuration of the instances. | <code title="object&#40;&#123;&#10; enable_secure_boot &#61; bool&#10; enable_vtpm &#61; bool&#10; enable_integrity_monitoring &#61; bool&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [service_account_scopes](variables.tf#L240) | Scopes applied to service account. | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> | | [tag_bindings](variables.tf#L252) | Tag bindings for this instance, in key => tag value id format. | <code>map&#40;string&#41;</code> | | <code>null</code> |
| [shielded_config](variables.tf#L246) | Shielded VM configuration of the instances. | <code title="object&#40;&#123;&#10; enable_secure_boot &#61; bool&#10; enable_vtpm &#61; bool&#10; enable_integrity_monitoring &#61; bool&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> | | [tags](variables.tf#L258) | Instance network tags for firewall rule targets. | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> |
| [tag_bindings](variables.tf#L256) | Tag bindings for this instance, in key => tag value id format. | <code>map&#40;string&#41;</code> | | <code>null</code> |
| [tags](variables.tf#L262) | Instance network tags for firewall rule targets. | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> |
## Outputs ## Outputs

View File

@ -29,12 +29,6 @@ locals {
for k, v in local.attached_disks : for k, v in local.attached_disks :
k => v if try(v.options.replica_zone, null) == null k => v if try(v.options.replica_zone, null) == null
} }
network_interface_options = {
for i, v in var.network_interfaces : i => lookup(var.network_interface_options, i, {
alias_ips = null,
nic_type = null
})
}
on_host_maintenance = ( on_host_maintenance = (
var.options.spot || var.confidential_compute var.options.spot || var.confidential_compute
? "TERMINATE" ? "TERMINATE"
@ -169,7 +163,7 @@ resource "google_compute_instance" "default" {
} }
boot_disk { boot_disk {
auto_delete = var.boot_disk_delete auto_delete = var.boot_disk.auto_delete
initialize_params { initialize_params {
type = var.boot_disk.type type = var.boot_disk.type
image = var.boot_disk.image image = var.boot_disk.image
@ -200,14 +194,14 @@ resource "google_compute_instance" "default" {
} }
} }
dynamic "alias_ip_range" { dynamic "alias_ip_range" {
for_each = local.network_interface_options[config.key].alias_ips != null ? local.network_interface_options[config.key].alias_ips : {} for_each = config.value.alias_ips
iterator = config_alias iterator = config_alias
content { content {
subnetwork_range_name = config_alias.key subnetwork_range_name = config_alias.key
ip_cidr_range = config_alias.value ip_cidr_range = config_alias.value
} }
} }
nic_type = local.network_interface_options[config.key].nic_type nic_type = config.value.nic_type
} }
} }
@ -272,7 +266,7 @@ resource "google_compute_instance_template" "default" {
labels = var.labels labels = var.labels
disk { disk {
auto_delete = var.boot_disk_delete auto_delete = var.boot_disk.auto_delete
boot = true boot = true
disk_size_gb = var.boot_disk.size disk_size_gb = var.boot_disk.size
disk_type = var.boot_disk.type disk_type = var.boot_disk.type
@ -334,14 +328,14 @@ resource "google_compute_instance_template" "default" {
} }
} }
dynamic "alias_ip_range" { dynamic "alias_ip_range" {
for_each = local.network_interface_options[config.key].alias_ips != null ? local.network_interface_options[config.key].alias_ips : {} for_each = config.value.alias_ips
iterator = config_alias iterator = config_alias
content { content {
subnetwork_range_name = config_alias.key subnetwork_range_name = config_alias.key
ip_cidr_range = config_alias.value ip_cidr_range = config_alias.value
} }
} }
nic_type = local.network_interface_options[config.key].nic_type nic_type = config.value.nic_type
} }
} }

View File

@ -22,7 +22,6 @@ variable "attached_disk_defaults" {
type = string type = string
}) })
default = { default = {
auto_delete = true
mode = "READ_WRITE" mode = "READ_WRITE"
replica_zone = null replica_zone = null
type = "pd-balanced" type = "pd-balanced"
@ -34,13 +33,20 @@ variable "attached_disks" {
type = list(object({ type = list(object({
name = string name = string
size = string size = string
source = string source = optional(string)
source_type = string source_type = optional(string)
options = object({ options = optional(
mode = string object({
replica_zone = string mode = optional(string, "READ_WRITE")
type = string replica_zone = optional(string)
}) type = optional(string, "pd-balanced")
}),
{
mode = "READ_WRITE"
replica_zone = null
type = "pd-balanced"
}
)
})) }))
default = [] default = []
validation { validation {
@ -58,23 +64,19 @@ variable "attached_disks" {
variable "boot_disk" { variable "boot_disk" {
description = "Boot disk properties." description = "Boot disk properties."
type = object({ type = object({
image = string auto_delete = optional(bool, true)
size = number image = optional(string, "projects/debian-cloud/global/images/family/debian-11")
type = string size = optional(number, 10)
type = optional(string, "pd-balanced")
}) })
default = { default = {
image = "projects/debian-cloud/global/images/family/debian-11" auto_delete = true
type = "pd-balanced" image = "projects/debian-cloud/global/images/family/debian-11"
size = 10 type = "pd-balanced"
size = 10
} }
} }
variable "boot_disk_delete" {
description = "Auto delete boot disk."
type = bool
default = true
}
variable "can_ip_forward" { variable "can_ip_forward" {
description = "Enable IP forwarding." description = "Enable IP forwarding."
type = bool type = bool
@ -97,6 +99,7 @@ variable "description" {
type = string type = string
default = "Managed by the compute-vm Terraform module." default = "Managed by the compute-vm Terraform module."
} }
variable "enable_display" { variable "enable_display" {
description = "Enable virtual display on the instances." description = "Enable virtual display on the instances."
type = bool type = bool
@ -106,9 +109,9 @@ variable "enable_display" {
variable "encryption" { variable "encryption" {
description = "Encryption options. Only one of kms_key_self_link and disk_encryption_key_raw may be set. If needed, you can specify to encrypt or not the boot disk." description = "Encryption options. Only one of kms_key_self_link and disk_encryption_key_raw may be set. If needed, you can specify to encrypt or not the boot disk."
type = object({ type = object({
encrypt_boot = bool encrypt_boot = optional(bool, false)
disk_encryption_key_raw = string disk_encryption_key_raw = optional(string)
kms_key_self_link = string kms_key_self_link = optional(string)
}) })
default = null default = null
} }
@ -162,35 +165,28 @@ variable "name" {
type = string type = string
} }
variable "network_interface_options" {
description = "Network interfaces extended options. The key is the index of the inteface to configure. The value is an object with alias_ips and nic_type. Set alias_ips or nic_type to null if you need only one of them."
type = map(object({
alias_ips = map(string)
nic_type = string
}))
default = {}
}
variable "network_interfaces" { variable "network_interfaces" {
description = "Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed." description = "Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed."
type = list(object({ type = list(object({
nat = bool nat = optional(bool, false)
network = string network = string
subnetwork = string subnetwork = string
addresses = object({ addresses = optional(object({
internal = string internal = string
external = string external = string
}) }), null)
alias_ips = optional(map(string), {})
nic_type = optional(string)
})) }))
} }
variable "options" { variable "options" {
description = "Instance options." description = "Instance options."
type = object({ type = object({
allow_stopping_for_update = bool allow_stopping_for_update = optional(bool, true)
deletion_protection = bool deletion_protection = optional(bool, false)
spot = bool spot = optional(bool, false)
termination_action = string termination_action = optional(string)
}) })
default = { default = {
allow_stopping_for_update = true allow_stopping_for_update = true

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
terraform { terraform {
required_version = ">= 1.3.0" required_version = ">= 1.3.2"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" source = "hashicorp/google"

Some files were not shown because too many files have changed in this diff Show More