Merge branch 'master' into example-wordpress
This commit is contained in:
commit
54290fb18e
|
@ -37,7 +37,7 @@ jobs:
|
|||
- name: Set up Terraform
|
||||
uses: hashicorp/setup-terraform@v1
|
||||
with:
|
||||
terraform_version: 1.3
|
||||
terraform_version: 1.3.2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
|
|
@ -30,7 +30,7 @@ env:
|
|||
PYTEST_ADDOPTS: "--color=yes"
|
||||
PYTHON_VERSION: "3.10"
|
||||
TF_PLUGIN_CACHE_DIR: "/home/runner/.terraform.d/plugin-cache"
|
||||
TF_VERSION: 1.3.0
|
||||
TF_VERSION: 1.3.2
|
||||
|
||||
jobs:
|
||||
doc-examples:
|
||||
|
@ -48,10 +48,18 @@ jobs:
|
|||
with:
|
||||
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
|
||||
run: |
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
|
||||
find -name versions.tf -exec cp default-versions.tf {} \;
|
||||
for f in $(find . -name versions.tf); do
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
|
||||
done
|
||||
|
||||
- name: Run tests on documentation examples
|
||||
id: pytest
|
||||
|
@ -76,15 +84,17 @@ jobs:
|
|||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Set up Terraform
|
||||
uses: hashicorp/setup-terraform@v1
|
||||
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
|
||||
run: |
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
|
||||
find -name versions.tf -exec cp default-versions.tf {} \;
|
||||
for f in $(find . -name versions.tf); do
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
|
||||
done
|
||||
|
||||
- name: Run tests environments
|
||||
id: pytest
|
||||
|
@ -109,15 +119,17 @@ jobs:
|
|||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Set up Terraform
|
||||
uses: hashicorp/setup-terraform@v1
|
||||
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
|
||||
run: |
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
|
||||
find -name versions.tf -exec cp default-versions.tf {} \;
|
||||
for f in $(find . -name versions.tf); do
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
|
||||
done
|
||||
|
||||
- name: Run tests modules
|
||||
id: pytest
|
||||
|
@ -142,15 +154,17 @@ jobs:
|
|||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Set up Terraform
|
||||
uses: hashicorp/setup-terraform@v1
|
||||
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
|
||||
run: |
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
|
||||
find -name versions.tf -exec cp default-versions.tf {} \;
|
||||
for f in $(find . -name versions.tf); do
|
||||
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
|
||||
done
|
||||
|
||||
- name: Run tests on FAST stages
|
||||
id: pytest
|
||||
|
|
|
@ -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.
|
|
@ -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
|
||||
- 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)
|
||||
|
||||
|
|
|
@ -69,8 +69,6 @@ module "server" {
|
|||
network_interfaces = [{
|
||||
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
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
metadata = {
|
||||
# Enables OpenSSH in the Windows instance
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -104,8 +104,6 @@ module "simple-vm-example" {
|
|||
network_interfaces = [{
|
||||
network = module.vpc.self_link
|
||||
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"]
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -94,13 +94,9 @@ module "instance_template_ew1" {
|
|||
network_interfaces = [{
|
||||
network = module.vpc.self_link
|
||||
subnetwork = module.vpc.subnet_self_links["europe-west1/subnet-ew1"]
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
boot_disk = {
|
||||
image = "projects/debian-cloud/global/images/family/debian-11"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
metadata = {
|
||||
startup-script-url = "gs://cloud-training/gcpnet/httplb/startup.sh"
|
||||
|
@ -119,13 +115,9 @@ module "instance_template_ue1" {
|
|||
network_interfaces = [{
|
||||
network = module.vpc.self_link
|
||||
subnetwork = module.vpc.subnet_self_links["us-east1/subnet-ue1"]
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
boot_disk = {
|
||||
image = "projects/debian-cloud/global/images/family/debian-11"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
metadata = {
|
||||
startup-script-url = "gs://cloud-training/gcpnet/httplb/startup.sh"
|
||||
|
@ -146,12 +138,9 @@ module "vm_siege" {
|
|||
network = module.vpc.self_link
|
||||
subnetwork = module.vpc.subnet_self_links["us-west1/subnet-uw1"]
|
||||
nat = true
|
||||
addresses = null
|
||||
}]
|
||||
boot_disk = {
|
||||
image = "projects/debian-cloud/global/images/family/debian-11"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
metadata = {
|
||||
startup-script = <<EOT
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -155,13 +155,9 @@ module "squid-vm" {
|
|||
network_interfaces = [{
|
||||
network = module.vpc.self_link
|
||||
subnetwork = module.vpc.subnet_self_links["${var.region}/proxy"]
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
boot_disk = {
|
||||
image = "cos-cloud/cos-stable"
|
||||
type = "pd-standard"
|
||||
size = 10
|
||||
}
|
||||
service_account = module.service-account-squid.email
|
||||
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -33,8 +33,6 @@ module "vm-left" {
|
|||
{
|
||||
network = module.vpc-left.self_link
|
||||
subnetwork = values(module.vpc-left.subnet_self_links)[0]
|
||||
nat = false
|
||||
addresses = null
|
||||
}
|
||||
]
|
||||
tags = ["ssh"]
|
||||
|
@ -58,8 +56,6 @@ module "vm-right" {
|
|||
{
|
||||
network = module.vpc-right.self_link
|
||||
subnetwork = values(module.vpc-right.subnet_self_links)[0]
|
||||
nat = false
|
||||
addresses = null
|
||||
}
|
||||
]
|
||||
tags = ["ssh"]
|
||||
|
|
|
@ -20,7 +20,7 @@ locals {
|
|||
Description=Start monitoring agent container
|
||||
After=gcr-online.target docker.socket
|
||||
Wants=gcr-online.target docker.socket docker-events-collector.service
|
||||
|
||||
|
||||
[Service]
|
||||
Environment="HOME=/home/opsagent"
|
||||
ExecStartPre=/usr/bin/docker-credential-gcr configure-docker
|
||||
|
@ -35,7 +35,7 @@ locals {
|
|||
logging:
|
||||
service:
|
||||
pipelines:
|
||||
default_pipeline:
|
||||
default_pipeline:
|
||||
receivers: []
|
||||
metrics:
|
||||
receivers:
|
||||
|
@ -227,42 +227,34 @@ module "service-account-proxy" {
|
|||
}
|
||||
|
||||
module "cos-nginx" {
|
||||
count = !var.tls ? 1 : 0
|
||||
source = "../../../modules/cloud-config-container/nginx"
|
||||
|
||||
image = var.nginx_image
|
||||
files = local.nginx_files
|
||||
users = local.users
|
||||
|
||||
count = !var.tls ? 1 : 0
|
||||
source = "../../../modules/cloud-config-container/nginx"
|
||||
image = var.nginx_image
|
||||
files = local.nginx_files
|
||||
users = local.users
|
||||
runcmd_pre = ["sed -i \"s/HOSTNAME/$${HOSTNAME}/\" /etc/nginx/conf.d/default.conf"]
|
||||
runcmd_post = ["systemctl start monitoring-agent"]
|
||||
}
|
||||
|
||||
module "cos-nginx-tls" {
|
||||
count = var.tls ? 1 : 0
|
||||
source = "../../../modules/cloud-config-container/nginx-tls"
|
||||
|
||||
count = var.tls ? 1 : 0
|
||||
source = "../../../modules/cloud-config-container/nginx-tls"
|
||||
nginx_image = var.nginx_image
|
||||
files = local.nginx_files
|
||||
users = local.users
|
||||
|
||||
runcmd_post = ["systemctl start monitoring-agent"]
|
||||
}
|
||||
|
||||
module "mig-proxy" {
|
||||
source = "../../../modules/compute-mig"
|
||||
project_id = module.project.project_id
|
||||
|
||||
location = var.region
|
||||
regional = true
|
||||
|
||||
name = format("%sproxy-cluster", var.prefix)
|
||||
|
||||
location = var.region
|
||||
regional = true
|
||||
name = format("%sproxy-cluster", var.prefix)
|
||||
named_ports = {
|
||||
http = "80"
|
||||
https = "443"
|
||||
}
|
||||
|
||||
autoscaler_config = var.autoscaling == null ? null : {
|
||||
min_replicas = var.autoscaling.min_replicas
|
||||
max_replicas = var.autoscaling.max_replicas
|
||||
|
@ -271,7 +263,6 @@ module "mig-proxy" {
|
|||
load_balancing_utilization_target = null
|
||||
metric = var.autoscaling_metric
|
||||
}
|
||||
|
||||
update_policy = {
|
||||
type = "PROACTIVE"
|
||||
minimal_action = "REPLACE"
|
||||
|
@ -281,12 +272,10 @@ module "mig-proxy" {
|
|||
max_unavailable_type = null
|
||||
max_unavailable = null
|
||||
}
|
||||
|
||||
default_version = {
|
||||
instance_template = module.proxy-vm.template.self_link
|
||||
name = "proxy-vm"
|
||||
}
|
||||
|
||||
health_check_config = {
|
||||
type = "http"
|
||||
check = {
|
||||
|
@ -308,45 +297,32 @@ module "mig-proxy" {
|
|||
}
|
||||
|
||||
module "proxy-vm" {
|
||||
source = "../../../modules/compute-vm"
|
||||
|
||||
project_id = module.project.project_id
|
||||
|
||||
zone = format("%s-c", var.region)
|
||||
name = "nginx-test-vm"
|
||||
|
||||
source = "../../../modules/compute-vm"
|
||||
project_id = module.project.project_id
|
||||
zone = format("%s-c", var.region)
|
||||
name = "nginx-test-vm"
|
||||
instance_type = "e2-standard-2"
|
||||
|
||||
tags = ["proxy-cluster"]
|
||||
tags = ["proxy-cluster"]
|
||||
network_interfaces = [{
|
||||
network = module.vpc.self_link
|
||||
subnetwork = module.vpc.subnet_self_links[format("%s/%s", var.region, var.subnetwork)]
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
|
||||
boot_disk = {
|
||||
image = "projects/cos-cloud/global/images/family/cos-stable"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
|
||||
create_template = true
|
||||
metadata = {
|
||||
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_create = false
|
||||
}
|
||||
|
||||
module "xlb" {
|
||||
source = "../../../modules/net-glb"
|
||||
name = format("%sreverse-proxy-xlb", var.prefix)
|
||||
project_id = module.project.project_id
|
||||
|
||||
source = "../../../modules/net-glb"
|
||||
name = format("%sreverse-proxy-xlb", var.prefix)
|
||||
project_id = module.project.project_id
|
||||
reserve_ip_address = true
|
||||
|
||||
health_checks_config = {
|
||||
format("%sreverse-proxy-hc", var.prefix) = {
|
||||
type = "http"
|
||||
|
@ -364,13 +340,11 @@ module "xlb" {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
backend_services_config = {
|
||||
format("%sreverse-proxy-backend", var.prefix) = {
|
||||
bucket_config = null
|
||||
enable_cdn = false
|
||||
cdn_config = null
|
||||
|
||||
group_config = {
|
||||
backends = [
|
||||
{
|
||||
|
@ -378,7 +352,6 @@ module "xlb" {
|
|||
options = null
|
||||
}
|
||||
]
|
||||
|
||||
health_checks = [format("%sreverse-proxy-hc", var.prefix)]
|
||||
log_config = null
|
||||
options = {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -237,8 +237,6 @@ module "vm-test1" {
|
|||
network_interfaces = [{
|
||||
network = module.vpc.self_link
|
||||
subnetwork = module.vpc.subnet_self_links["${var.region.gcp1}/subnet1"]
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
metadata = { startup-script = local.vm-startup-script }
|
||||
service_account = module.service-account-gce.email
|
||||
|
@ -312,8 +310,6 @@ module "vm-onprem" {
|
|||
name = "onprem"
|
||||
boot_disk = {
|
||||
image = "ubuntu-os-cloud/ubuntu-1804-lts"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
metadata = {
|
||||
user-data = module.config-onprem.cloud_config
|
||||
|
@ -321,8 +317,6 @@ module "vm-onprem" {
|
|||
network_interfaces = [{
|
||||
network = module.vpc.name
|
||||
subnetwork = module.vpc.subnet_self_links["${var.region.gcp1}/subnet1"]
|
||||
nat = true
|
||||
addresses = null
|
||||
}]
|
||||
service_account = module.service-account-onprem.email
|
||||
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -178,12 +178,8 @@ module "test-vm" {
|
|||
instance_type = "e2-micro"
|
||||
boot_disk = {
|
||||
image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2104"
|
||||
type = "pd-balanced"
|
||||
size = 10
|
||||
}
|
||||
network_interfaces = [{
|
||||
addresses = null
|
||||
nat = false
|
||||
network = module.vpc-onprem.self_link
|
||||
subnetwork = module.vpc-onprem.subnet_self_links["${var.region}/${var.name}-onprem"]
|
||||
}]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
@ -33,5 +33,3 @@ terraform {
|
|||
version = ">= 3.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,28 +38,20 @@ module "nva-template-ew1" {
|
|||
{
|
||||
network = module.landing-untrusted-vpc.self_link
|
||||
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
|
||||
subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west1/landing-trusted-default-ew1"]
|
||||
nat = false
|
||||
addresses = null
|
||||
}
|
||||
]
|
||||
boot_disk = {
|
||||
image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
type = "pd-balanced"
|
||||
size = 10
|
||||
}
|
||||
create_template = true
|
||||
instance_type = "f1-micro"
|
||||
options = {
|
||||
allow_stopping_for_update = true
|
||||
deletion_protection = false
|
||||
spot = true
|
||||
termination_action = "STOP"
|
||||
spot = true
|
||||
termination_action = "STOP"
|
||||
}
|
||||
metadata = {
|
||||
startup-script = templatefile(
|
||||
|
|
|
@ -26,20 +26,13 @@
|
|||
# network_interfaces = [{
|
||||
# network = module.landing-untrusted-vpc.self_link
|
||||
# subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west1/landing-untrusted-default-ew1"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew1", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -59,20 +52,13 @@
|
|||
# network_interfaces = [{
|
||||
# network = module.landing-untrusted-vpc.self_link
|
||||
# subnetwork = module.landing-untrusted-vpc.subnet_self_links["europe-west4/landing-untrusted-default-ew4"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew4", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -94,22 +80,15 @@
|
|||
# network_interfaces = [{
|
||||
# network = module.landing-trusted-vpc.self_link
|
||||
# subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west1/landing-trusted-default-ew1"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew1", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
# metadata = {
|
||||
# startup-script = <<EOF
|
||||
|
@ -127,20 +106,13 @@
|
|||
# network_interfaces = [{
|
||||
# network = module.landing-trusted-vpc.self_link
|
||||
# subnetwork = module.landing-trusted-vpc.subnet_self_links["europe-west4/landing-trusted-default-ew4"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew4", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -163,20 +135,13 @@
|
|||
# network = module.dev-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew1", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -197,20 +162,13 @@
|
|||
# network = module.dev-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew4", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -233,9 +191,6 @@
|
|||
# network = module.prod-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew1", "ssh"]
|
||||
# service_account_create = true
|
||||
|
@ -245,8 +200,6 @@
|
|||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -267,20 +220,13 @@
|
|||
# network = module.prod-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ew4", "ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
|
|
@ -24,20 +24,13 @@
|
|||
# network_interfaces = [{
|
||||
# network = module.landing-vpc.self_link
|
||||
# subnetwork = module.landing-vpc.subnet_self_links["europe-west1/landing-default-ew1"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -58,20 +51,13 @@
|
|||
# network = module.dev-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -92,20 +78,13 @@
|
|||
# network = module.prod-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
|
|
@ -24,20 +24,13 @@
|
|||
# network_interfaces = [{
|
||||
# network = module.landing-vpc.self_link
|
||||
# subnetwork = module.landing-vpc.subnet_self_links["europe-west1/landing-default-ew1"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -58,20 +51,13 @@
|
|||
# network = module.dev-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
@ -92,20 +78,13 @@
|
|||
# network = module.prod-spoke-vpc.self_link
|
||||
# # 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"]
|
||||
# alias_ips = {}
|
||||
# nat = false
|
||||
# addresses = null
|
||||
# }]
|
||||
# tags = ["ssh"]
|
||||
# service_account_create = true
|
||||
# boot_disk = {
|
||||
# image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
# type = "pd-balanced"
|
||||
# size = 10
|
||||
# }
|
||||
# options = {
|
||||
# allow_stopping_for_update = true
|
||||
# deletion_protection = false
|
||||
# spot = true
|
||||
# termination_action = "STOP"
|
||||
# }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -22,8 +22,6 @@ module "simple-vm-example" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
service_account_create = true
|
||||
}
|
||||
|
@ -42,16 +40,12 @@ module "spot-vm-example" {
|
|||
zone = "europe-west1-b"
|
||||
name = "test"
|
||||
options = {
|
||||
allow_stopping_for_update = true
|
||||
deletion_protection = false
|
||||
spot = true
|
||||
termination_action = "STOP"
|
||||
}
|
||||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
service_account_create = true
|
||||
}
|
||||
|
@ -79,18 +73,14 @@ module "simple-vm-example" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
attached_disks = [{
|
||||
name = "repd-1"
|
||||
size = null
|
||||
size = 10
|
||||
source_type = "attach"
|
||||
source = "regions/${var.region}/disks/repd-test-1"
|
||||
options = {
|
||||
mode = null
|
||||
replica_zone = "${var.region}-c"
|
||||
type = null
|
||||
}
|
||||
}]
|
||||
service_account_create = true
|
||||
|
@ -109,18 +99,14 @@ module "simple-vm-example" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
attached_disks = [{
|
||||
name = "repd"
|
||||
size = null
|
||||
size = 10
|
||||
source_type = "attach"
|
||||
source = "https://www.googleapis.com/compute/v1/projects/${var.project_id}/regions/${var.region}/disks/repd-test-1"
|
||||
options = {
|
||||
mode = null
|
||||
replica_zone = "${var.region}-c"
|
||||
type = null
|
||||
}
|
||||
}]
|
||||
service_account_create = true
|
||||
|
@ -142,27 +128,19 @@ module "kms-vm-example" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
attached_disks = [
|
||||
{
|
||||
name = "attached-disk"
|
||||
size = 10
|
||||
source = null
|
||||
source_type = null
|
||||
options = null
|
||||
size = 10
|
||||
}
|
||||
]
|
||||
service_account_create = true
|
||||
boot_disk = {
|
||||
image = "projects/debian-cloud/global/images/family/debian-10"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
encryption = {
|
||||
encrypt_boot = true
|
||||
disk_encryption_key_raw = null
|
||||
kms_key_self_link = var.kms_key.self_link
|
||||
}
|
||||
}
|
||||
|
@ -182,17 +160,10 @@ module "vm-with-alias-ips" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
network_interface_options = {
|
||||
0 = {
|
||||
alias_ips = {
|
||||
alias1 = "10.16.0.10/32"
|
||||
}
|
||||
nic_type = null
|
||||
alias_ips = {
|
||||
alias1 = "10.16.0.10/32"
|
||||
}
|
||||
}
|
||||
}]
|
||||
service_account_create = true
|
||||
}
|
||||
# tftest modules=1 resources=2
|
||||
|
@ -231,20 +202,12 @@ module "vm-with-gvnic" {
|
|||
boot_disk = {
|
||||
image = google_compute_image.cos-gvnic.self_link
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
nic_type = "GVNIC"
|
||||
}]
|
||||
network_interface_options = {
|
||||
0 = {
|
||||
alias_ips = null
|
||||
nic_type = "GVNIC"
|
||||
}
|
||||
}
|
||||
service_account_create = true
|
||||
}
|
||||
# tftest modules=1 resources=3
|
||||
|
@ -263,21 +226,14 @@ module "cos-test" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
boot_disk = {
|
||||
image = "projects/cos-cloud/global/images/family/cos-stable"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
attached_disks = [
|
||||
{
|
||||
name = "disk-1"
|
||||
size = 10
|
||||
source = null
|
||||
source_type = null
|
||||
options = null
|
||||
}
|
||||
]
|
||||
service_account = "vm-default@my-project.iam.gserviceaccount.com"
|
||||
|
@ -303,13 +259,9 @@ module "instance-group" {
|
|||
network_interfaces = [{
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
nat = false
|
||||
addresses = null
|
||||
}]
|
||||
boot_disk = {
|
||||
image = "projects/cos-cloud/global/images/family/cos-stable"
|
||||
type = "pd-ssd"
|
||||
size = 10
|
||||
}
|
||||
service_account = var.service_account.email
|
||||
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
|
||||
|
@ -326,36 +278,34 @@ module "instance-group" {
|
|||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [name](variables.tf#L160) | 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(object({ nat = bool network = string subnetwork = string addresses = object({ internal = string external = string }) }))">list(object({…}))</code> | ✓ | |
|
||||
| [project_id](variables.tf#L209) | Project id. | <code>string</code> | ✓ | |
|
||||
| [zone](variables.tf#L268) | Compute zone. | <code>string</code> | ✓ | |
|
||||
| [attached_disk_defaults](variables.tf#L17) | Defaults for attached disks options. | <code title="object({ mode = string replica_zone = string type = string })">object({…})</code> | | <code title="{ auto_delete = true mode = "READ_WRITE" replica_zone = null type = "pd-balanced" }">{…}</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(object({ name = string size = string source = string source_type = string options = object({ mode = string replica_zone = string type = string }) }))">list(object({…}))</code> | | <code>[]</code> |
|
||||
| [boot_disk](variables.tf#L58) | Boot disk properties. | <code title="object({ image = string size = number type = string })">object({…})</code> | | <code title="{ image = "projects/debian-cloud/global/images/family/debian-11" type = "pd-balanced" size = 10 }">{…}</code> |
|
||||
| [boot_disk_delete](variables.tf#L72) | Auto delete boot disk. | <code>bool</code> | | <code>true</code> |
|
||||
| [can_ip_forward](variables.tf#L78) | Enable IP forwarding. | <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#L90) | Create instance template instead of instances. | <code>bool</code> | | <code>false</code> |
|
||||
| [description](variables.tf#L95) | Description of a Compute Instance. | <code>string</code> | | <code>"Managed by the compute-vm Terraform module."</code> |
|
||||
| [enable_display](variables.tf#L100) | Enable virtual display on the instances. | <code>bool</code> | | <code>false</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({ encrypt_boot = bool disk_encryption_key_raw = string kms_key_self_link = string })">object({…})</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({ named_ports = map(number) })">object({…})</code> | | <code>null</code> |
|
||||
| [hostname](variables.tf#L124) | Instance FQDN name. | <code>string</code> | | <code>null</code> |
|
||||
| [iam](variables.tf#L130) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [instance_type](variables.tf#L136) | Instance type. | <code>string</code> | | <code>"f1-micro"</code> |
|
||||
| [labels](variables.tf#L142) | Instance labels. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [metadata](variables.tf#L148) | Instance metadata. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [min_cpu_platform](variables.tf#L154) | Minimum CPU platform. | <code>string</code> | | <code>null</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(object({ alias_ips = map(string) nic_type = string }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [options](variables.tf#L187) | Instance options. | <code title="object({ allow_stopping_for_update = bool deletion_protection = bool spot = bool termination_action = string })">object({…})</code> | | <code title="{ allow_stopping_for_update = true deletion_protection = false spot = false termination_action = null }">{…}</code> |
|
||||
| [scratch_disks](variables.tf#L214) | Scratch disks configuration. | <code title="object({ count = number interface = string })">object({…})</code> | | <code title="{ count = 0 interface = "NVME" }">{…}</code> |
|
||||
| [service_account](variables.tf#L226) | Service account email. Unused if service account is auto-created. | <code>string</code> | | <code>null</code> |
|
||||
| [service_account_create](variables.tf#L232) | Auto-create service account. | <code>bool</code> | | <code>false</code> |
|
||||
| [service_account_scopes](variables.tf#L240) | Scopes applied to service account. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [shielded_config](variables.tf#L246) | Shielded VM configuration of the instances. | <code title="object({ enable_secure_boot = bool enable_vtpm = bool enable_integrity_monitoring = bool })">object({…})</code> | | <code>null</code> |
|
||||
| [tag_bindings](variables.tf#L256) | Tag bindings for this instance, in key => tag value id format. | <code>map(string)</code> | | <code>null</code> |
|
||||
| [tags](variables.tf#L262) | Instance network tags for firewall rule targets. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [name](variables.tf#L163) | Instance name. | <code>string</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(object({ nat = optional(bool, false) network = string subnetwork = string addresses = optional(object({ internal = string external = string }), null) alias_ips = optional(map(string), {}) nic_type = optional(string) }))">list(object({…}))</code> | ✓ | |
|
||||
| [project_id](variables.tf#L205) | Project id. | <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({ mode = string replica_zone = string type = string })">object({…})</code> | | <code title="{ mode = "READ_WRITE" replica_zone = null type = "pd-balanced" }">{…}</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(object({ name = string size = string source = optional(string) source_type = optional(string) options = optional( object({ mode = optional(string, "READ_WRITE") replica_zone = optional(string) type = optional(string, "pd-balanced") }), { mode = "READ_WRITE" replica_zone = null type = "pd-balanced" } ) }))">list(object({…}))</code> | | <code>[]</code> |
|
||||
| [boot_disk](variables.tf#L64) | Boot disk properties. | <code title="object({ auto_delete = optional(bool, true) image = optional(string, "projects/debian-cloud/global/images/family/debian-11") size = optional(number, 10) type = optional(string, "pd-balanced") })">object({…})</code> | | <code title="{ auto_delete = true image = "projects/debian-cloud/global/images/family/debian-11" type = "pd-balanced" size = 10 }">{…}</code> |
|
||||
| [can_ip_forward](variables.tf#L80) | 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> |
|
||||
| [create_template](variables.tf#L92) | 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>"Managed by the compute-vm Terraform module."</code> |
|
||||
| [enable_display](variables.tf#L103) | 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({ encrypt_boot = optional(bool, false) disk_encryption_key_raw = optional(string) kms_key_self_link = optional(string) })">object({…})</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({ named_ports = map(number) })">object({…})</code> | | <code>null</code> |
|
||||
| [hostname](variables.tf#L127) | Instance FQDN name. | <code>string</code> | | <code>null</code> |
|
||||
| [iam](variables.tf#L133) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [instance_type](variables.tf#L139) | Instance type. | <code>string</code> | | <code>"f1-micro"</code> |
|
||||
| [labels](variables.tf#L145) | Instance labels. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [metadata](variables.tf#L151) | Instance metadata. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [min_cpu_platform](variables.tf#L157) | Minimum CPU platform. | <code>string</code> | | <code>null</code> |
|
||||
| [options](variables.tf#L183) | Instance options. | <code title="object({ allow_stopping_for_update = optional(bool, true) deletion_protection = optional(bool, false) spot = optional(bool, false) termination_action = optional(string) })">object({…})</code> | | <code title="{ allow_stopping_for_update = true deletion_protection = false spot = false termination_action = null }">{…}</code> |
|
||||
| [scratch_disks](variables.tf#L210) | Scratch disks configuration. | <code title="object({ count = number interface = string })">object({…})</code> | | <code title="{ count = 0 interface = "NVME" }">{…}</code> |
|
||||
| [service_account](variables.tf#L222) | Service account email. Unused if service account is auto-created. | <code>string</code> | | <code>null</code> |
|
||||
| [service_account_create](variables.tf#L228) | Auto-create service account. | <code>bool</code> | | <code>false</code> |
|
||||
| [service_account_scopes](variables.tf#L236) | Scopes applied to service account. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [shielded_config](variables.tf#L242) | Shielded VM configuration of the instances. | <code title="object({ enable_secure_boot = bool enable_vtpm = bool enable_integrity_monitoring = bool })">object({…})</code> | | <code>null</code> |
|
||||
| [tag_bindings](variables.tf#L252) | Tag bindings for this instance, in key => tag value id format. | <code>map(string)</code> | | <code>null</code> |
|
||||
| [tags](variables.tf#L258) | Instance network tags for firewall rule targets. | <code>list(string)</code> | | <code>[]</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
|
|
@ -29,12 +29,6 @@ locals {
|
|||
for k, v in local.attached_disks :
|
||||
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 = (
|
||||
var.options.spot || var.confidential_compute
|
||||
? "TERMINATE"
|
||||
|
@ -169,7 +163,7 @@ resource "google_compute_instance" "default" {
|
|||
}
|
||||
|
||||
boot_disk {
|
||||
auto_delete = var.boot_disk_delete
|
||||
auto_delete = var.boot_disk.auto_delete
|
||||
initialize_params {
|
||||
type = var.boot_disk.type
|
||||
image = var.boot_disk.image
|
||||
|
@ -200,14 +194,14 @@ resource "google_compute_instance" "default" {
|
|||
}
|
||||
}
|
||||
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
|
||||
content {
|
||||
subnetwork_range_name = config_alias.key
|
||||
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
|
||||
|
||||
disk {
|
||||
auto_delete = var.boot_disk_delete
|
||||
auto_delete = var.boot_disk.auto_delete
|
||||
boot = true
|
||||
disk_size_gb = var.boot_disk.size
|
||||
disk_type = var.boot_disk.type
|
||||
|
@ -334,14 +328,14 @@ resource "google_compute_instance_template" "default" {
|
|||
}
|
||||
}
|
||||
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
|
||||
content {
|
||||
subnetwork_range_name = config_alias.key
|
||||
ip_cidr_range = config_alias.value
|
||||
}
|
||||
}
|
||||
nic_type = local.network_interface_options[config.key].nic_type
|
||||
nic_type = config.value.nic_type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ variable "attached_disk_defaults" {
|
|||
type = string
|
||||
})
|
||||
default = {
|
||||
auto_delete = true
|
||||
mode = "READ_WRITE"
|
||||
replica_zone = null
|
||||
type = "pd-balanced"
|
||||
|
@ -34,13 +33,20 @@ variable "attached_disks" {
|
|||
type = list(object({
|
||||
name = string
|
||||
size = string
|
||||
source = string
|
||||
source_type = string
|
||||
options = object({
|
||||
mode = string
|
||||
replica_zone = string
|
||||
type = string
|
||||
})
|
||||
source = optional(string)
|
||||
source_type = optional(string)
|
||||
options = optional(
|
||||
object({
|
||||
mode = optional(string, "READ_WRITE")
|
||||
replica_zone = optional(string)
|
||||
type = optional(string, "pd-balanced")
|
||||
}),
|
||||
{
|
||||
mode = "READ_WRITE"
|
||||
replica_zone = null
|
||||
type = "pd-balanced"
|
||||
}
|
||||
)
|
||||
}))
|
||||
default = []
|
||||
validation {
|
||||
|
@ -58,23 +64,19 @@ variable "attached_disks" {
|
|||
variable "boot_disk" {
|
||||
description = "Boot disk properties."
|
||||
type = object({
|
||||
image = string
|
||||
size = number
|
||||
type = string
|
||||
auto_delete = optional(bool, true)
|
||||
image = optional(string, "projects/debian-cloud/global/images/family/debian-11")
|
||||
size = optional(number, 10)
|
||||
type = optional(string, "pd-balanced")
|
||||
})
|
||||
default = {
|
||||
image = "projects/debian-cloud/global/images/family/debian-11"
|
||||
type = "pd-balanced"
|
||||
size = 10
|
||||
auto_delete = true
|
||||
image = "projects/debian-cloud/global/images/family/debian-11"
|
||||
type = "pd-balanced"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
variable "boot_disk_delete" {
|
||||
description = "Auto delete boot disk."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "can_ip_forward" {
|
||||
description = "Enable IP forwarding."
|
||||
type = bool
|
||||
|
@ -97,6 +99,7 @@ variable "description" {
|
|||
type = string
|
||||
default = "Managed by the compute-vm Terraform module."
|
||||
}
|
||||
|
||||
variable "enable_display" {
|
||||
description = "Enable virtual display on the instances."
|
||||
type = bool
|
||||
|
@ -106,9 +109,9 @@ variable "enable_display" {
|
|||
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."
|
||||
type = object({
|
||||
encrypt_boot = bool
|
||||
disk_encryption_key_raw = string
|
||||
kms_key_self_link = string
|
||||
encrypt_boot = optional(bool, false)
|
||||
disk_encryption_key_raw = optional(string)
|
||||
kms_key_self_link = optional(string)
|
||||
})
|
||||
default = null
|
||||
}
|
||||
|
@ -162,35 +165,28 @@ variable "name" {
|
|||
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" {
|
||||
description = "Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed."
|
||||
type = list(object({
|
||||
nat = bool
|
||||
nat = optional(bool, false)
|
||||
network = string
|
||||
subnetwork = string
|
||||
addresses = object({
|
||||
addresses = optional(object({
|
||||
internal = string
|
||||
external = string
|
||||
})
|
||||
}), null)
|
||||
alias_ips = optional(map(string), {})
|
||||
nic_type = optional(string)
|
||||
}))
|
||||
}
|
||||
|
||||
variable "options" {
|
||||
description = "Instance options."
|
||||
type = object({
|
||||
allow_stopping_for_update = bool
|
||||
deletion_protection = bool
|
||||
spot = bool
|
||||
termination_action = string
|
||||
allow_stopping_for_update = optional(bool, true)
|
||||
deletion_protection = optional(bool, false)
|
||||
spot = optional(bool, false)
|
||||
termination_action = optional(string)
|
||||
})
|
||||
default = {
|
||||
allow_stopping_for_update = true
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.3.0"
|
||||
required_version = ">= 1.3.2"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue