Skip to content

Commit

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

* update
  • Loading branch information
yupwei68 authored Sep 7, 2020
1 parent 1230ea9 commit 605edfe
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 3 deletions.
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-postgresql"
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 => 'v0.5.0'
gem 'terramodtest', :tag => 'v0.7.0'
end
end
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,61 @@

This Terraform module creates a Azure PostgreSQL Database.

## Usage in Terraform 0.13

```hcl
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-rg"
location = "West Europe"
}
module "postgresql" {
source = "Azure/postgresql/azurerm"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
server_name = "example-server"
sku_name = "GP_Gen5_2"
storage_mb = 5120
backup_retention_days = 7
geo_redundant_backup_enabled = false
administrator_login = "login"
administrator_password = "password"
server_version = "9.5"
ssl_enforcement_enabled = true
db_names = ["my_db1", "my_db2"]
db_charset = "UTF8"
db_collation = "English_United States.1252"
firewall_rule_prefix = "firewall-"
firewall_rules = [
{ name = "test1", start_ip = "10.0.0.5", end_ip = "10.0.0.8" },
{ start_ip = "127.0.0.0", end_ip = "127.0.1.0" },
]
vnet_rule_name_prefix = "postgresql-vnet-rule-"
vnet_rules = [
{ name = "subnet1", subnet_id = "<subnet_id>" }
]
tags = {
Environment = "Production",
CostCenter = "Contoso IT",
}
postgresql_configurations = {
backslash_quote = "on",
}
depends_on = [azurerm_resource_group.example]
}
```

## Usage

```hcl
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pool:

variables:
image_name: terraform-azurerm-postgresql:$(build.buildId)
terraform_version: 0.12.20
terraform_version: 0.13.0

steps:
- script: docker build --build-arg BUILD_TERRAFORM_VERSION=$(terraform_version) --build-arg BUILD_ARM_SUBSCRIPTION_ID=$(ARM_SUBSCRIPTION_ID) --build-arg BUILD_ARM_CLIENT_ID=$(ARM_CLIENT_ID) --build-arg BUILD_ARM_CLIENT_SECRET=$(ARM_CLIENT_SECRET) --build-arg BUILD_ARM_TENANT_ID=$(ARM_TENANT_ID) -t $(image_name) .
Expand Down
2 changes: 2 additions & 0 deletions test/fixture/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ module "postgresql" {
vnet_rules = [
{ name = "subnet1", subnet_id = azurerm_subnet.test.id }
]

depends_on = [azurerm_resource_group.test]
}

18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,85 +1,103 @@
variable "resource_group_name" {
description = "The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created."
type = string
}

variable "location" {
description = "Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created."
type = string
}

variable "server_name" {
description = "Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created."
type = string
}

variable "sku_name" {
description = "Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the tier + family + cores pattern (e.g. B_Gen4_1, GP_Gen5_8)."
type = string
default = "GP_Gen5_4"
}

variable "storage_mb" {
description = "Max storage allowed for a server. Possible values are between 5120 MB(5GB) and 1048576 MB(1TB) for the Basic SKU and between 5120 MB(5GB) and 4194304 MB(4TB) for General Purpose/Memory Optimized SKUs."
type = number
default = 102400
}

variable "backup_retention_days" {
description = "Backup retention days for the server, supported values are between 7 and 35 days."
type = number
default = 7
}

variable "geo_redundant_backup_enabled" {
description = "Enable Geo-redundant or not for server backup. Valid values for this property are Enabled or Disabled, not supported for the basic tier."
type = bool
default = false
}

variable "administrator_login" {
description = "The Administrator Login for the PostgreSQL Server. Changing this forces a new resource to be created."
type = string
}

variable "administrator_password" {
description = "The Password associated with the administrator_login for the PostgreSQL Server."
type = string
}

variable "server_version" {
description = "Specifies the version of PostgreSQL to use. Valid values are 9.5, 9.6, and 10.0. Changing this forces a new resource to be created."
type = string
default = "9.5"
}

variable "ssl_enforcement_enabled" {
description = "Specifies if SSL should be enforced on connections. Possible values are Enabled and Disabled."
type = bool
default = true
}

variable "db_names" {
description = "The list of names of the PostgreSQL Database, which needs to be a valid PostgreSQL identifier. Changing this forces a new resource to be created."
type = list(string)
default = []
}

variable "db_charset" {
description = "Specifies the Charset for the PostgreSQL Database, which needs to be a valid PostgreSQL Charset. Changing this forces a new resource to be created."
type = string
default = "UTF8"
}

variable "db_collation" {
description = "Specifies the Collation for the PostgreSQL Database, which needs to be a valid PostgreSQL Collation. Note that Microsoft uses different notation - en-US instead of en_US. Changing this forces a new resource to be created."
type = string
default = "English_United States.1252"
}

variable "firewall_rule_prefix" {
description = "Specifies prefix for firewall rule names."
type = string
default = "firewall-"
}

variable "firewall_rules" {
description = "The list of maps, describing firewall rules. Valid map items: name, start_ip, end_ip."
type = list(map(string))
default = []
}

variable "vnet_rule_name_prefix" {
description = "Specifies prefix for vnet rule names."
type = string
default = "postgresql-vnet-rule-"
}

variable "vnet_rules" {
description = "The list of maps, describing vnet rules. Valud map items: name, subnet_id."
type = list(map(string))
default = []
}

Expand Down

0 comments on commit 605edfe

Please sign in to comment.