Skip to content

Commit

Permalink
Terraform 0.13 upgrade (#27)
Browse files Browse the repository at this point in the history
* 0.13 TF upgrade

* update
  • Loading branch information
yupwei68 authored Sep 7, 2020
1 parent da29f31 commit e3b0482
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- docker

env:
- TERRAFORM_VERSION=0.12.20 IMAGE_NAME=azure-loadbalancer-module
- TERRAFORM_VERSION=0.13.0 IMAGE_NAME=azure-loadbalancer-module

jobs:
include:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pull the base image with given version.
ARG BUILD_TERRAFORM_VERSION="0.12.20"
ARG BUILD_TERRAFORM_VERSION="0.13.0"
FROM mcr.microsoft.com/terraform-test:${BUILD_TERRAFORM_VERSION}

ARG MODULE_NAME="terraform-azurerm-loadbalancer"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ source 'https://rubygems.org/'

group :test do
git 'https://github.com/Azure/terramodtest.git' do
gem 'terramodtest', :tag => '0.5.0'
gem 'terramodtest', :tag => '0.7.0'
end
end
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,43 @@ characteristics:
- For `private` loadbalancer, specify the private ip address using`frontend_private_ip_address`
- Specify the type of the private ip address with `frontend_private_ip_address_allocation`, Dynamic or Static , default is `Dynamic`

## Usage
## Usage in Terraform 0.13

Public loadbalancer example:

```hcl
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-lb"
location = "West Europe"
}
module "mylb" {
source = "Azure/loadbalancer/azurerm"
resource_group_name = azurerm_resource_group.example.name
prefix = "terraform-test"
remote_port = {
ssh = ["Tcp", "22"]
}
lb_port = {
http = ["80", "Tcp", "80"]
}
lb_probe = {
http = ["Tcp", "80", ""]
}
depends_on = [azurerm_resource_group.example]
}
```

## Usage in Terraform 0.12

Public loadbalancer example:

Expand Down
2 changes: 2 additions & 0 deletions test/fixture/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module "mylb" {
cost-center = "12345"
source = "terraform"
}

depends_on = [azurerm_resource_group.test]
}

module "network" {
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "public_ip" {
value = "${module.mylb.azurerm_public_ip_address}"
value = module.mylb.azurerm_public_ip_address
}
14 changes: 13 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
variable "location" {
description = "(Optional) The location/region where the core network will be created. The full list of Azure regions can be found at https://azure.microsoft.com/regions"
type = string
default = ""
}

variable "resource_group_name" {
description = "(Required) The name of the resource group where the load balancer resources will be imported."
type = string
}

variable "prefix" {
description = "(Required) Default prefix to use with your resource names."
type = string
default = "azure_lb"
}

variable "remote_port" {
description = "Protocols to be used for remote vm access. [protocol, backend_port]. Frontend port will be automatically generated starting at 50000 and in the output."
type = map(any)
default = {}
}

Expand All @@ -25,21 +29,25 @@ variable "lb_port" {

variable "lb_probe_unhealthy_threshold" {
description = "Number of times the load balancer health probe has an unsuccessful attempt before considering the endpoint unhealthy."
type = number
default = 2
}

variable "lb_probe_interval" {
description = "Interval in seconds the load balancer health probe rule does a check"
type = number
default = 5
}

variable "frontend_name" {
description = "(Required) Specifies the name of the frontend ip configuration."
type = string
default = "myPublicIP"
}

variable "allocation_method" {
description = "(Required) Defines how an IP address is assigned. Options are Static or Dynamic."
type = string
default = "Static"
}

Expand All @@ -52,28 +60,32 @@ variable "tags" {
}

variable "type" {
type = string
description = "(Optional) Defined if the loadbalancer is private or public"
type = string
default = "public"
}

variable "frontend_subnet_id" {
description = "(Optional) Frontend subnet id to use when in private mode"
type = string
default = ""
}

variable "frontend_private_ip_address" {
description = "(Optional) Private ip address to assign to frontend. Use it with type = private"
type = string
default = ""
}

variable "frontend_private_ip_address_allocation" {
description = "(Optional) Frontend ip allocation type (Static or Dynamic)"
type = string
default = "Dynamic"
}

variable "lb_sku" {
description = "(Optional) The SKU of the Azure Load Balancer. Accepted values are Basic and Standard."
type = string
default = "Basic"
}

Expand Down

0 comments on commit e3b0482

Please sign in to comment.