Skip to content

Commit

Permalink
feat!: add Terraform 0.13 constraint and module attribution (#32)
Browse files Browse the repository at this point in the history
* feat!: add Terraform 0.13 constraint and module attribution

* Adding IAM API to setup and bumped versions

Co-authored-by: James Duncan <[email protected]>
  • Loading branch information
cloud-foundation-bot and JamesDuncanNz authored Apr 1, 2021
1 parent 47c3d0c commit 5a3c282
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.6.0
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.13
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Modular Regional TCP Load Balancer for GCE using target pool and forwarding rule
* [Internal load balancer](https://github.com/terraform-google-modules/terraform-google-lb-internal)

## Compatibility
This module is meant for use with Terraform 0.12. If you haven't [upgraded](https://www.terraform.io/upgrade-guides/0-12.html) and need a Terraform 0.11.x-compatible version of this module, the last released version intended for Terraform 0.11.x is [1.0.3](https://github.com/terraform-google-modules/terraform-google-lb/releases/tag/1.0.3)
This module is meant for use with Terraform 0.13. If you haven't
[upgraded](https://www.terraform.io/upgrade-guides/0-13.html) and need a Terraform
0.12.x-compatible version of this module, the last released version
intended for Terraform 0.12.x is [v2.3.0](https://registry.terraform.io/modules/terraform-google-modules/-lb/google/v2.3.0).

## Usage
Basic usage is as follows:
Expand Down Expand Up @@ -51,20 +54,21 @@ Full functional examples are located in the [examples](./examples/) directory.
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| disable\_health\_check | Disables the health check on the target pool. | bool | `"false"` | no |
| firewall\_project | Name of the project to create the firewall rule in. Useful for shared VPC. Default is var.project. | string | `""` | no |
| health\_check | Health check to determine whether instances are responsive and able to do work | object | `<map>` | no |
| ip\_address | IP address of the external load balancer, if empty one will be assigned. Default is empty. | string | `""` | no |
| ip\_protocol | The IP protocol for the frontend forwarding rule and firewall rule. TCP, UDP, ESP, AH, SCTP or ICMP. | string | `"TCP"` | no |
| name | Name for the forwarding rule and prefix for supporting resources. | string | n/a | yes |
| network | Name of the network to create resources in. | string | `"default"` | no |
| project | The project to deploy to, if not set the default provider project is used. | string | `""` | no |
| region | Region used for GCP resources. | string | n/a | yes |
| service\_port | TCP port your service is listening on. | number | n/a | yes |
| session\_affinity | How to distribute load. Options are `NONE`, `CLIENT_IP` and `CLIENT_IP_PROTO` | string | `"NONE"` | no |
| target\_tags | List of target tags to allow traffic using firewall rule. | list(string) | null | no |
| target\_service\_accounts | List of target service accounts to allow traffic using firewall rule. | list(string) | null | no |
|------|-------------|------|---------|:--------:|
| allowed\_ips | The IP address ranges which can access the load balancer. | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| disable\_health\_check | Disables the health check on the target pool. | `bool` | `false` | no |
| firewall\_project | Name of the project to create the firewall rule in. Useful for shared VPC. Default is var.project. | `string` | `""` | no |
| health\_check | Health check to determine whether instances are responsive and able to do work | <pre>object({<br> check_interval_sec = number<br> healthy_threshold = number<br> timeout_sec = number<br> unhealthy_threshold = number<br> port = number<br> request_path = string<br> host = string<br> })</pre> | <pre>{<br> "check_interval_sec": null,<br> "healthy_threshold": null,<br> "host": null,<br> "port": null,<br> "request_path": null,<br> "timeout_sec": null,<br> "unhealthy_threshold": null<br>}</pre> | no |
| ip\_address | IP address of the external load balancer, if empty one will be assigned. | `any` | `null` | no |
| ip\_protocol | The IP protocol for the frontend forwarding rule and firewall rule. TCP, UDP, ESP, AH, SCTP or ICMP. | `string` | `"TCP"` | no |
| name | Name for the forwarding rule and prefix for supporting resources. | `string` | n/a | yes |
| network | Name of the network to create resources in. | `string` | `"default"` | no |
| project | The project to deploy to, if not set the default provider project is used. | `string` | `""` | no |
| region | Region used for GCP resources. | `string` | n/a | yes |
| service\_port | TCP port your service is listening on. | `number` | n/a | yes |
| session\_affinity | How to distribute load. Options are `NONE`, `CLIENT_IP` and `CLIENT_IP_PROTO` | `string` | `"NONE"` | no |
| target\_service\_accounts | List of target service accounts to allow traffic using firewall rule. | `list(string)` | `null` | no |
| target\_tags | List of target tags to allow traffic using firewall rule. | `list(string)` | `null` | no |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.6.0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

steps:
- name: 'gcr.io/cloud-foundation-cicd/cft/developer-tools:0.6.0'
- name: 'gcr.io/cloud-foundation-cicd/cft/developer-tools:0.13'
id: 'lint'
args: ['/usr/local/bin/test_lint.sh']
tags:
Expand Down
9 changes: 9 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ echo http://$(terraform output load_balancer_ip)
* `terraform destroy` to remove all resources created by terraform

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

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| image\_family | Image used for compute VMs. | `string` | `"debian-9"` | no |
| image\_project | GCP Project where source image comes from. | `string` | `"debian-cloud"` | no |
| project\_id | GCP Project used to create resources. | `any` | n/a | yes |
| region | n/a | `string` | `"us-central1"` | no |

## Outputs

| Name | Description |
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "google_service_account" "instance-group" {

module "instance_template" {
source = "terraform-google-modules/vm/google//modules/instance_template"
version = "~> 1.0.0"
version = "~> 6.2.0"
subnetwork = google_compute_subnetwork.subnetwork.self_link
source_image_family = var.image_family
source_image_project = var.image_project
Expand All @@ -42,7 +42,7 @@ module "instance_template" {

module "managed_instance_group" {
source = "terraform-google-modules/vm/google//modules/mig"
version = "~> 1.0.0"
version = "~> 6.2.0"
region = var.region
target_size = 2
hostname = "mig-simple"
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

provider "google" {
version = ">= 2.7.0"
version = ">= 3.53.0"
project = var.project_id
}

provider "google-beta" {
version = ">= 2.7.0"
version = ">= 3.53.0"
project = var.project_id
}
2 changes: 1 addition & 1 deletion test/integration/basic/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name: basic
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.10.0
tag: v1.8.8
attributes:
- name: project_id
required: true
Expand Down
5 changes: 3 additions & 2 deletions test/setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

module "lb-project" {
source = "terraform-google-modules/project-factory/google"
version = "~> 3.0"
version = "~> 10.2"

name = "ci-lb"
random_project_id = "true"
Expand All @@ -27,6 +27,7 @@ module "lb-project" {
activate_apis = [
"replicapool.googleapis.com",
"resourceviews.googleapis.com",
"serviceusage.googleapis.com"
"serviceusage.googleapis.com",
"iam.googleapis.com"
]
}
4 changes: 2 additions & 2 deletions test/setup/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ terraform {
}

provider "google" {
version = "~> 2.18.0"
version = "~> 3.53.0"
}

provider "google-beta" {
version = "~> 2.18.0"
version = "~> 3.53.0"
}

16 changes: 14 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019 Google LLC
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,5 +15,17 @@
*/

terraform {
required_version = ">= 0.12"
required_version = ">= 0.13"
required_providers {

google = {
source = "hashicorp/google"
version = "~> 3.53"
}
}

provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-lb/v1.0.0"
}

}

0 comments on commit 5a3c282

Please sign in to comment.