diff --git a/.env.template b/.env.template index 2ebb2b32..0bd49b9a 100644 --- a/.env.template +++ b/.env.template @@ -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="" diff --git a/devops/providers/azure-devops/README.md b/devops/providers/azure-devops/README.md index 6b85c0bf..95411a79 100644 --- a/devops/providers/azure-devops/README.md +++ b/devops/providers/azure-devops/README.md @@ -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' diff --git a/devops/providers/azure-devops/templates/azure-pipeline-all-templates.yml b/devops/providers/azure-devops/templates/azure-pipeline-all-templates.yml index b1b0404a..0c6f72d4 100644 --- a/devops/providers/azure-devops/templates/azure-pipeline-all-templates.yml +++ b/devops/providers/azure-devops/templates/azure-pipeline-all-templates.yml @@ -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' diff --git a/devops/providers/azure-devops/templates/azure-pipelines.yml b/devops/providers/azure-devops/templates/azure-pipelines.yml index ccc1f231..bf03ece9 100644 --- a/devops/providers/azure-devops/templates/azure-pipelines.yml +++ b/devops/providers/azure-devops/templates/azure-pipelines.yml @@ -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' diff --git a/devops/providers/gitlab/templates/sample.tf b/devops/providers/gitlab/templates/sample.tf index 580b2f38..e1c6b0a1 100644 --- a/devops/providers/gitlab/templates/sample.tf +++ b/devops/providers/gitlab/templates/sample.tf @@ -6,7 +6,6 @@ # See README.me for more provider "azurerm" { - version = "=2.22" features {} } diff --git a/go.mod b/go.mod index 5bcd301a..d99fd761 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 0cbd761e..6ddc2a23 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/infra/modules/providers/azure/app-gateway/output.tf b/infra/modules/providers/azure/app-gateway/output.tf index 0839ed8f..1bba60e1 100644 --- a/infra/modules/providers/azure/app-gateway/output.tf +++ b/infra/modules/providers/azure/app-gateway/output.tf @@ -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 } diff --git a/infra/modules/providers/azure/app-gateway/versions.tf b/infra/modules/providers/azure/app-gateway/versions.tf index ac97c6ac..9d585006 100644 --- a/infra/modules/providers/azure/app-gateway/versions.tf +++ b/infra/modules/providers/azure/app-gateway/versions.tf @@ -1,4 +1,4 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } diff --git a/infra/modules/providers/azure/container-registry/tests/tf_options.go b/infra/modules/providers/azure/container-registry/tests/tf_options.go index 8dd4012b..c2a01fac 100644 --- a/infra/modules/providers/azure/container-registry/tests/tf_options.go +++ b/infra/modules/providers/azure/container-registry/tests/tf_options.go @@ -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") diff --git a/infra/modules/providers/azure/container-registry/versions.tf b/infra/modules/providers/azure/container-registry/versions.tf index ac97c6ac..9d585006 100755 --- a/infra/modules/providers/azure/container-registry/versions.tf +++ b/infra/modules/providers/azure/container-registry/versions.tf @@ -1,4 +1,4 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } diff --git a/infra/modules/providers/azure/data-factory/versions.tf b/infra/modules/providers/azure/data-factory/versions.tf index 284618f5..e6128d41 100644 --- a/infra/modules/providers/azure/data-factory/versions.tf +++ b/infra/modules/providers/azure/data-factory/versions.tf @@ -1,8 +1,7 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } provider "azurerm" { - version = "~>2.9.0" features {} } \ No newline at end of file diff --git a/infra/modules/providers/azure/function-app/versions.tf b/infra/modules/providers/azure/function-app/versions.tf index 3b7e865a..c46c10d7 100644 --- a/infra/modules/providers/azure/function-app/versions.tf +++ b/infra/modules/providers/azure/function-app/versions.tf @@ -3,6 +3,5 @@ terraform { } provider "azurerm" { - version = "~>2.9.0" features {} } diff --git a/infra/modules/providers/azure/keyvault-cert/versions.tf b/infra/modules/providers/azure/keyvault-cert/versions.tf index ac97c6ac..9d585006 100755 --- a/infra/modules/providers/azure/keyvault-cert/versions.tf +++ b/infra/modules/providers/azure/keyvault-cert/versions.tf @@ -1,4 +1,4 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } diff --git a/infra/modules/providers/azure/keyvault/versions.tf b/infra/modules/providers/azure/keyvault/versions.tf index ac97c6ac..9d585006 100755 --- a/infra/modules/providers/azure/keyvault/versions.tf +++ b/infra/modules/providers/azure/keyvault/versions.tf @@ -1,4 +1,4 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } diff --git a/infra/modules/providers/azure/network/versions.tf b/infra/modules/providers/azure/network/versions.tf index be9c3611..9989778a 100644 --- a/infra/modules/providers/azure/network/versions.tf +++ b/infra/modules/providers/azure/network/versions.tf @@ -1,8 +1,7 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } provider "azurerm" { - version = "~> 2.9.0" features {} } diff --git a/infra/modules/providers/azure/provider/main.tf b/infra/modules/providers/azure/provider/main.tf index edbad584..cc0b48d5 100644 --- a/infra/modules/providers/azure/provider/main.tf +++ b/infra/modules/providers/azure/provider/main.tf @@ -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" } \ No newline at end of file diff --git a/infra/modules/providers/azure/traffic-manager/versions.tf b/infra/modules/providers/azure/traffic-manager/versions.tf index ac97c6ac..9d585006 100755 --- a/infra/modules/providers/azure/traffic-manager/versions.tf +++ b/infra/modules/providers/azure/traffic-manager/versions.tf @@ -1,4 +1,4 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } diff --git a/infra/modules/providers/azure/vnet/main.tf b/infra/modules/providers/azure/vnet/main.tf new file mode 100644 index 00000000..d458d332 --- /dev/null +++ b/infra/modules/providers/azure/vnet/main.tf @@ -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] +} \ No newline at end of file diff --git a/infra/modules/providers/azure/vnet/output.tf b/infra/modules/providers/azure/vnet/output.tf new file mode 100644 index 00000000..8a738fc0 --- /dev/null +++ b/infra/modules/providers/azure/vnet/output.tf @@ -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 +} \ No newline at end of file diff --git a/infra/modules/providers/azure/vnet/variables.tf b/infra/modules/providers/azure/vnet/variables.tf new file mode 100644 index 00000000..3bc6029c --- /dev/null +++ b/infra/modules/providers/azure/vnet/variables.tf @@ -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 = "" + } +} \ No newline at end of file diff --git a/infra/modules/providers/devops/variable-group/version.tf b/infra/modules/providers/devops/variable-group/version.tf index 99b6b3ea..279dc99e 100644 --- a/infra/modules/providers/devops/variable-group/version.tf +++ b/infra/modules/providers/devops/variable-group/version.tf @@ -1,3 +1,2 @@ provider "azuredevops" { - version = ">= 0.0.1" } \ No newline at end of file diff --git a/infra/modules/providers/elastic/provider/main.tf b/infra/modules/providers/elastic/provider/main.tf index 32f3baa3..43d3ea96 100644 --- a/infra/modules/providers/elastic/provider/main.tf +++ b/infra/modules/providers/elastic/provider/main.tf @@ -1,8 +1,6 @@ provider "null" { - version = "~>2.1.0" } provider "external" { - version = "~> 1.0" } \ No newline at end of file diff --git a/infra/templates/ado-bootstrap-iac-pipeline/azdo.tf b/infra/templates/ado-bootstrap-iac-pipeline/azdo.tf index df501830..e29319de 100644 --- a/infra/templates/ado-bootstrap-iac-pipeline/azdo.tf +++ b/infra/templates/ado-bootstrap-iac-pipeline/azdo.tf @@ -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 diff --git a/infra/templates/ado-bootstrap-iac-pipeline/azure.tf b/infra/templates/ado-bootstrap-iac-pipeline/azure.tf index b6e4a89c..d827f61e 100644 --- a/infra/templates/ado-bootstrap-iac-pipeline/azure.tf +++ b/infra/templates/ado-bootstrap-iac-pipeline/azure.tf @@ -1,11 +1,8 @@ provider "azuread" { - version = 0.8 } provider "random" { - version = 2.2 } provider "azurerm" { - version = "=2.0.0" features {} } diff --git a/infra/templates/az-hello-world/backend.tf b/infra/templates/az-hello-world/backend.tf index fc541d1f..d97335c7 100644 --- a/infra/templates/az-hello-world/backend.tf +++ b/infra/templates/az-hello-world/backend.tf @@ -5,7 +5,6 @@ terraform { } provider "azurerm" { - version = "~> 2.9.0" features {} } diff --git a/infra/templates/az-isolated-service-single-region/backend.tf b/infra/templates/az-isolated-service-single-region/backend.tf index 4e580c0d..e12b16ff 100644 --- a/infra/templates/az-isolated-service-single-region/backend.tf +++ b/infra/templates/az-isolated-service-single-region/backend.tf @@ -5,6 +5,5 @@ terraform { } provider "azurerm" { - version = "~> 2.9.0" features {} } diff --git a/infra/templates/az-service-single-region/admin.tf b/infra/templates/az-service-single-region/admin.tf index 73c5cf0c..d90d106d 100644 --- a/infra/templates/az-service-single-region/admin.tf +++ b/infra/templates/az-service-single-region/admin.tf @@ -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 diff --git a/infra/templates/az-service-single-region/appdev.tf b/infra/templates/az-service-single-region/appdev.tf index e12b8d13..b13e2423 100644 --- a/infra/templates/az-service-single-region/appdev.tf +++ b/infra/templates/az-service-single-region/appdev.tf @@ -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" { diff --git a/infra/templates/az-service-single-region/backend.tf b/infra/templates/az-service-single-region/backend.tf index fc541d1f..d97335c7 100644 --- a/infra/templates/az-service-single-region/backend.tf +++ b/infra/templates/az-service-single-region/backend.tf @@ -5,7 +5,6 @@ terraform { } provider "azurerm" { - version = "~> 2.9.0" features {} } diff --git a/infra/templates/az-service-single-region/outputs.tf b/infra/templates/az-service-single-region/outputs.tf index 62de2ef0..3a13f10a 100644 --- a/infra/templates/az-service-single-region/outputs.tf +++ b/infra/templates/az-service-single-region/outputs.tf @@ -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" { diff --git a/infra/templates/az-service-single-region/variables.tf b/infra/templates/az-service-single-region/variables.tf index 1badb2d7..e4261bd6 100644 --- a/infra/templates/az-service-single-region/variables.tf +++ b/infra/templates/az-service-single-region/variables.tf @@ -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"]] } diff --git a/infra/templates/az-service-single-region/versions.tf b/infra/templates/az-service-single-region/versions.tf index ac97c6ac..9d585006 100644 --- a/infra/templates/az-service-single-region/versions.tf +++ b/infra/templates/az-service-single-region/versions.tf @@ -1,4 +1,4 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.14" } diff --git a/infra/templates/backend-state-setup/variables.tf b/infra/templates/backend-state-setup/variables.tf index e107bab4..854dfdae 100644 --- a/infra/templates/backend-state-setup/variables.tf +++ b/infra/templates/backend-state-setup/variables.tf @@ -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." } diff --git a/infra/templates/gitlab-bootstrap-iac-cicd/provider.tf b/infra/templates/gitlab-bootstrap-iac-cicd/provider.tf index ba3cce09..8073a198 100644 --- a/infra/templates/gitlab-bootstrap-iac-cicd/provider.tf +++ b/infra/templates/gitlab-bootstrap-iac-cicd/provider.tf @@ -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" } diff --git a/test-harness/build-base-image.sh b/test-harness/build-base-image.sh index 45ec581b..de792a73 100755 --- a/test-harness/build-base-image.sh +++ b/test-harness/build-base-image.sh @@ -111,7 +111,7 @@ function build_image(){ } declare go_version="1.12.5" -declare tf_version="0.12.2" +declare tf_version="0.14.4" parseInput "$@" declare docker_img="msftcse/cobalt-test-base"