diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8a67326 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) and this +project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +### Changed + +- Supported version of Terraform is 0.12. [#11] + +## [1.0.3] - 2018-08-21 + + +## [1.0.2] - 2017-11-08 + + +## [1.0.1] - 2017-19-09 + + +## [1.0.0] - 2017-08-28 + + +[Unreleased]: https://github.com/GoogleCloudPlatform/terraform-google-lb/compare/v1.0.3...HEAD +[1.0.3]: https://github.com/GoogleCloudPlatform/terraform-google-lb/compare/v1.0.2...v1.0.3 +[1.0.2]: https://github.com/GoogleCloudPlatform/terraform-google-lb/compare/v1.0.1...v1.0.2 +[1.0.1]: https://github.com/GoogleCloudPlatform/terraform-google-lb/compare/v1.0.0...v1.0.1 +[1.0.0]: https://github.com/GoogleCloudPlatform/terraform-google-lb/releases/tag/1.0.0 +[#11]: https://github.com/terraform-google-modules/terraform-google-vm/pull/11 \ No newline at end of file diff --git a/README.md b/README.md index 1a7d133..e675488 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ Modular Regional TCP Load Balancer for GCE using target pool and forwarding rule +## 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/GoogleCloudPlatform/terraform-google-lb/releases/tag/1.0.3) + ## Usage ```ruby diff --git a/examples/basic/README.md b/examples/basic/README.md index 21975dc..8ee40c3 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -1,3 +1,7 @@ +### Note + + This example should be updated to use with terraform-0.12 after the next release of terraform-google-modules/vm/google/mig + # TCP Forwarding Rule Example [![button](http://gstatic.com/cloudssh/images/open-btn.png)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/terraform-google-lb&working_dir=examples/basic&page=shell&tutorial=README.md) diff --git a/main.tf b/main.tf index c63a3dc..ad046fe 100644 --- a/main.tf +++ b/main.tf @@ -15,41 +15,43 @@ */ resource "google_compute_forwarding_rule" "default" { - project = "${var.project}" - name = "${var.name}" - target = "${google_compute_target_pool.default.self_link}" + project = var.project + name = var.name + target = google_compute_target_pool.default.self_link load_balancing_scheme = "EXTERNAL" - port_range = "${var.service_port}" + port_range = var.service_port + region = var.region } resource "google_compute_target_pool" "default" { - project = "${var.project}" - name = "${var.name}" - region = "${var.region}" - session_affinity = "${var.session_affinity}" + project = var.project + name = var.name + region = var.region + session_affinity = var.session_affinity health_checks = [ - "${google_compute_http_health_check.default.name}", + google_compute_http_health_check.default.name, ] } resource "google_compute_http_health_check" "default" { - project = "${var.project}" + project = var.project name = "${var.name}-hc" request_path = "/" - port = "${var.service_port}" + port = var.service_port } resource "google_compute_firewall" "default-lb-fw" { - project = "${var.firewall_project == "" ? var.project : var.firewall_project}" + project = var.firewall_project == "" ? var.project : var.firewall_project name = "${var.name}-vm-service" - network = "${var.network}" + network = var.network allow { protocol = "tcp" - ports = ["${var.service_port}"] + ports = [var.service_port] } source_ranges = ["0.0.0.0/0"] - target_tags = ["${var.target_tags}"] + target_tags = var.target_tags } + diff --git a/outputs.tf b/outputs.tf index 2dbdc79..94ffbf8 100644 --- a/outputs.tf +++ b/outputs.tf @@ -14,12 +14,13 @@ * limitations under the License. */ -output target_pool { +output "target_pool" { description = "The `self_link` to the target pool resource created." - value = "${google_compute_target_pool.default.self_link}" + value = google_compute_target_pool.default.self_link } -output external_ip { +output "external_ip" { description = "The external ip address of the forwarding rule." - value = "${google_compute_forwarding_rule.default.ip_address}" + value = google_compute_forwarding_rule.default.ip_address } + diff --git a/variables.tf b/variables.tf index 0ad0f8d..14cd03d 100644 --- a/variables.tf +++ b/variables.tf @@ -14,40 +14,48 @@ * limitations under the License. */ -variable project { +variable "project" { + type = string description = "The project to deploy to, if not set the default provider project is used." default = "" } -variable region { +variable "region" { + type = string description = "Region for cloud resources." default = "us-central1" } -variable network { +variable "network" { + type = string description = "Name of the network to create resources in." default = "default" } -variable firewall_project { +variable "firewall_project" { + type = string description = "Name of the project to create the firewall rule in. Useful for shared VPC. Default is var.project." default = "" } -variable name { +variable "name" { + type = string description = "Name for the forwarding rule and prefix for supporting resources." } -variable service_port { +variable "service_port" { + type = number description = "TCP port your service is listening on." } -variable target_tags { +variable "target_tags" { description = "List of target tags to allow traffic using firewall rule." - type = "list" + type = list(string) } -variable session_affinity { +variable "session_affinity" { + type = string description = "How to distribute load. Options are `NONE`, `CLIENT_IP` and `CLIENT_IP_PROTO`" default = "NONE" } + diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..2970427 --- /dev/null +++ b/versions.tf @@ -0,0 +1,19 @@ +/** + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +terraform { + required_version = ">= 0.12" +}