Skip to content

Commit

Permalink
Changed syntax for terraform v0.13+
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrushuk committed Mar 26, 2021
1 parent 5f7cf81 commit 20feb66
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ locals {
# version used for both main AKS API service, and default node pool
# https://github.com/Azure/AKS/releases
# az aks get-versions --location uksouth --output table
kubernetes_version = "1.17.16"
kubernetes_version = "1.18.14"
location = "uksouth"
resource_group_name = "${random_string.aks.result}-rg-azurerm-kubernetes-cluster"
name = "${random_string.aks.result}-aks-cluster"
Expand Down
21 changes: 0 additions & 21 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
terraform {
# versioning syntax: https://www.terraform.io/docs/configuration/version-constraints.html#version-constraint-syntax
required_version = ">= 0.12"

# providers (pin all versions)
# versioning syntax: https://www.terraform.io/docs/configuration/modules.html#module-versions
# ~> 1.0 = 1.x
required_providers {
# https://github.com/terraform-providers/terraform-provider-azuread/releases
azuread = "~> 1.0"
random = "~> 2.2"
tls = "~> 2.1"
}
}

# https://github.com/terraform-providers/terraform-provider-azurerm/releases
provider "azurerm" {
version = "~> 2.20"
features {}
}

locals {
# TODO: consider moving defaults to object var, as per: https://binx.io/blog/2020/01/02/module-parameter-defaults-with-the-terraform-object-type/
default_agent_profile = {
Expand Down
5 changes: 1 addition & 4 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ cd test
terraform init
terraform validate

# Plan
terraform plan

# Apply
# Plan / Apply
terraform apply

# Outputs
Expand Down
7 changes: 1 addition & 6 deletions test/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Test AKS module
provider "azurerm" {
version = "2.47.0"
features {}
}

locals {
# version used for both main AKS API service, and default node pool
# https://github.com/Azure/AKS/releases
# az aks get-versions --location uksouth --output table
kubernetes_version = "1.17.16"
kubernetes_version = "1.18.14"
prefix = "rush"
location = "uksouth"
resource_group_name = "${local.prefix}-rg-azurerm-kubernetes-cluster"
Expand Down
14 changes: 14 additions & 0 deletions test/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_version = ">= 0.13"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.53.0"
}
}
}

provider "azurerm" {
features {}
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ variable "aks_admin_group_member_name" {
variable "kubernetes_version" {
description = "Version for both main AKS API service, and default node pool"
type = string
default = "1.17.16"
default = "1.18.14"
}

variable "sla_sku" {
Expand Down
35 changes: 35 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
terraform {
# versioning syntax: https://www.terraform.io/docs/configuration/version-constraints.html#version-constraint-syntax
required_version = ">= 0.13"

# versioning syntax: https://www.terraform.io/docs/configuration/modules.html#module-versions
# ~> 1.0 = 1.x
required_providers {

# https://github.com/terraform-providers/terraform-provider-azurerm/releases
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}

# https://github.com/terraform-providers/terraform-provider-azuread/releases
azuread = {
source = "hashicorp/azuread"
version = "~> 1.0"
}

random = {
source = "hashicorp/random"
version = "~> 2.0"
}

tls = {
source = "hashicorp/tls"
version = "~> 2.0"
}
}
}

provider "azurerm" {
features {}
}

0 comments on commit 20feb66

Please sign in to comment.