Skip to content

upgrade tf to 14 version and update vnet creation for az service sing… #413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Versioning
GO_VERSION=1.12.5
TF_VERSION=0.12.4
TF_VERSION=0.14.4
BUILD_BUILDID=1
# Azure Subscription Values
ARM_SUBSCRIPTION_ID="<az-service-principal-subscription-id>"
Expand Down
2 changes: 1 addition & 1 deletion devops/providers/azure-devops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Here's an example of an entry point `yaml` file. Entry point `yaml` files forwar

variables:
- name: 'TF_VERSION'
value: '0.12.20'
value: '0.14.4'
- name: 'GO_VERSION'
value: '1.12.14'
- name: 'TF_ROOT_DIR'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pr:

variables:
- name: 'TF_VERSION'
value: '0.12.24'
value: '0.14.4'
- name: 'GO_VERSION'
value: '1.12.14'
- name: 'TF_ROOT_DIR'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pr:

variables:
- name: 'TF_VERSION'
value: '0.12.24'
value: '0.14.4'
- name: 'GO_VERSION'
value: '1.12.14'
- name: 'TF_ROOT_DIR'
Expand Down
1 change: 0 additions & 1 deletion devops/providers/gitlab/templates/sample.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# See README.me for more

provider "azurerm" {
version = "=2.22"
features {}
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/Azure/go-autorest/autorest v0.9.3
github.com/Azure/go-autorest/autorest/adal v0.8.1
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2
github.com/elastic/go-elasticsearch/v6 v6.8.10
github.com/gruntwork-io/terratest v0.26.5
github.com/magefile/mage v1.8.0
github.com/microsoft/terratest-abstraction v0.0.0-20200417192312-d2dd8b2c5d11
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZ
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/elastic/go-elasticsearch v0.0.0 h1:Pd5fqOuBxKxv83b0+xOAJDAkziWYwFinWnBO0y+TZaA=
github.com/elastic/go-elasticsearch/v6 v6.8.10 h1:2lN0gJ93gMBXvkhwih5xquldszpm8FlUwqG5sPzr6a8=
github.com/elastic/go-elasticsearch/v6 v6.8.10/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
Expand Down
2 changes: 1 addition & 1 deletion infra/modules/providers/azure/app-gateway/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ output "app_gateway_health_probe_backend_address" {

output "resource_group_name" {
description = "The resource group name"
value = azurerm_application_gateway.resource_group_name
value = azurerm_application_gateway.appgateway.resource_group_name
}
2 changes: 1 addition & 1 deletion infra/modules/providers/azure/app-gateway/versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tests

import (
"os"
"github.com/gruntwork-io/terratest/modules/terraform"
"os"
)

var container_registry_name = os.Getenv("TF_VAR_container_registry_name")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
3 changes: 1 addition & 2 deletions infra/modules/providers/azure/data-factory/versions.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
provider "azurerm" {
version = "~>2.9.0"
features {}
}
1 change: 0 additions & 1 deletion infra/modules/providers/azure/function-app/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ terraform {
}

provider "azurerm" {
version = "~>2.9.0"
features {}
}
2 changes: 1 addition & 1 deletion infra/modules/providers/azure/keyvault-cert/versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
2 changes: 1 addition & 1 deletion infra/modules/providers/azure/keyvault/versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
3 changes: 1 addition & 2 deletions infra/modules/providers/azure/network/versions.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}

provider "azurerm" {
version = "~> 2.9.0"
features {}
}
5 changes: 1 addition & 4 deletions infra/modules/providers/azure/provider/main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
provider "azurerm" {
version = "~> 2.9.0"
version = "~> 1.44"
features {}
}

provider "null" {
version = "~>2.1.0"
}

provider "azuread" {
version = "~>0.7.0"
}

provider "external" {
version = "~> 1.0"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
22 changes: 22 additions & 0 deletions infra/modules/providers/azure/vnet/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
data "azurerm_resource_group" "vnet" {
name = var.resource_group_name
}

resource "azurerm_virtual_network" "vnet" {
name = var.vnet_name
location = data.azurerm_resource_group.vnet.location
address_space = [var.address_space]
resource_group_name = data.azurerm_resource_group.vnet.name
dns_servers = var.dns_servers
tags = var.tags
}

resource "azurerm_subnet" "subnet" {
count = length(var.subnet_names)
name = var.subnet_names[count.index]
virtual_network_name = azurerm_virtual_network.vnet.name
resource_group_name = data.azurerm_resource_group.vnet.name

address_prefix = var.subnet_prefixes[count.index]
service_endpoints = var.subnet_service_endpoints[count.index]
}
24 changes: 24 additions & 0 deletions infra/modules/providers/azure/vnet/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
output "vnet_id" {
description = "The id of the vNet"
value = azurerm_virtual_network.vnet.id
}

output "vnet_name" {
description = "The Name of the vNet"
value = azurerm_virtual_network.vnet.name
}

output "vnet_location" {
description = "The location of the vNet"
value = azurerm_virtual_network.vnet.location
}

output "vnet_address_space" {
description = "The address space of the vNet"
value = azurerm_virtual_network.vnet.address_space
}

output "vnet_subnet_ids" {
description = "The ids of subnets created inside the vNet"
value = azurerm_subnet.subnet.*.id
}
47 changes: 47 additions & 0 deletions infra/modules/providers/azure/vnet/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
variable "vnet_name" {
description = "Name of the vnet to create"
default = "acctvnet"
}

variable "resource_group_name" {
description = "Default resource group name that the network will be created in."
default = "myapp-rg"
}

variable "address_space" {
description = "The address space that is used by the virtual network."
default = "10.10.0.0/16"
}

# If no values specified, this defaults to Azure DNS
variable "dns_servers" {
description = "The DNS servers to be used with vNet."
default = []
}

variable "subnet_prefixes" {
description = "The address prefix to use for the subnet."
default = ["10.10.1.0/24", "10.10.2.0/24"]
}

variable "subnet_names" {
description = "A list of public subnets inside the vNet."
type = list(any)
default = ["subnet1", "subnet2"]
}

variable "subnet_service_endpoints" {
description = "A list of the service endpoints for the subnet (e.g. Microsoft.Web)"
type = list(any)
default = [[], []]
}

variable "tags" {
description = "The tags to associate with your network and subnets."
type = map(any)

default = {
tag1 = ""
tag2 = ""
}
}
1 change: 0 additions & 1 deletion infra/modules/providers/devops/variable-group/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
provider "azuredevops" {
version = ">= 0.0.1"
}
2 changes: 0 additions & 2 deletions infra/modules/providers/elastic/provider/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

provider "null" {
version = "~>2.1.0"
}

provider "external" {
version = "~> 1.0"
}
2 changes: 0 additions & 2 deletions infra/templates/ado-bootstrap-iac-pipeline/azdo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# AZDO_PERSONAL_ACCESS_TOKEN
# AZDO_ORG_SERVICE_URL
provider "azuredevops" {
version = ">= 0.0.1"
}

provider "null" {
version = "2.1.2"
}

// use the following two block (a `resource` and a `local` block) to
Expand Down
3 changes: 0 additions & 3 deletions infra/templates/ado-bootstrap-iac-pipeline/azure.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
provider "azuread" {
version = 0.8
}
provider "random" {
version = 2.2
}
provider "azurerm" {
version = "=2.0.0"
features {}
}

Expand Down
1 change: 0 additions & 1 deletion infra/templates/az-hello-world/backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ terraform {
}

provider "azurerm" {
version = "~> 2.9.0"
features {}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ terraform {
}

provider "azurerm" {
version = "~> 2.9.0"
features {}
}
2 changes: 1 addition & 1 deletion infra/templates/az-service-single-region/admin.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "azurerm_resource_group" "svcplan" {
}

module "vnet" {
source = "github.com/microsoft/bedrock?ref=0.12.0/cluster/azure/vnet"
source = "../../modules/providers/azure/vnet"
vnet_name = local.vnet_name
address_space = var.address_space
resource_group_name = azurerm_resource_group.svcplan.name
Expand Down
2 changes: 1 addition & 1 deletion infra/templates/az-service-single-region/appdev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "null_resource" "acr_image_deploy" {
depends_on = [module.container_registry]

triggers = {
images_to_deploy = "${join(",", [for target in var.deployment_targets : "${target.image_name}:${target.image_release_tag_prefix}"])}"
images_to_deploy = join(",", [for target in var.deployment_targets : "${target.image_name}:${target.image_release_tag_prefix}"])
}

provisioner "local-exec" {
Expand Down
1 change: 0 additions & 1 deletion infra/templates/az-service-single-region/backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ terraform {
}

provider "azurerm" {
version = "~> 2.9.0"
features {}
}

3 changes: 2 additions & 1 deletion infra/templates/az-service-single-region/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ output "tm_fqdn" {
}

output "public_cert" {
value = module.keyvault_certificate.public_cert
value = module.keyvault_certificate.public_cert
sensitive = true
}

output "service_plan_resource_group_name" {
Expand Down
2 changes: 1 addition & 1 deletion infra/templates/az-service-single-region/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ variable "azure_container_tags" {

variable "subnet_service_endpoints" {
description = "The list of service endpoints that will be given to each subnet"
type = list
type = list(any)
default = [["Microsoft.Web"]]
}

Expand Down
2 changes: 1 addition & 1 deletion infra/templates/az-service-single-region/versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.14"
}
4 changes: 2 additions & 2 deletions infra/templates/backend-state-setup/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
variable "name" {
type = "string"
type = string
description = "Specifies the human consumable label for this resource."
}

variable "location" {
type = "string"
type = string
description = "Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. See the name column in `az account list-locations -o table` for possible choices."
}
5 changes: 0 additions & 5 deletions infra/templates/gitlab-bootstrap-iac-cicd/provider.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
provider "azurerm" {
version = "=2.22"
features {}
}

provider "azuread" {
version = "=0.10.0"
}

provider "gitlab" {
version = "=2.10.0"
}

provider "random" {
version = "=2.2.1"
}

provider "tls" {
version = "=2.1.1"
}
Loading