configure subnet_ids instead of deprecated network_profile_id; introduce (#37)
dns_config
This commit is contained in:
Родитель
01488153a6
Коммит
13c11d2241
|
@ -322,7 +322,7 @@ We provide 2 ways to build, run, and test the module on a local development mach
|
|||
|
||||
- [Ruby **(~> 2.3)**](https://www.ruby-lang.org/en/downloads/)
|
||||
- [Bundler **(~> 1.15)**](https://bundler.io/)
|
||||
- [Terraform **(~> 0.11.7)**](https://www.terraform.io/downloads.html)
|
||||
- [Terraform **(~> 1.3)**](https://www.terraform.io/downloads.html)
|
||||
- [Golang **(~> 1.12.3)**](https://golang.org/dl/)
|
||||
|
||||
#### Environment setup
|
||||
|
|
|
@ -10,9 +10,9 @@ variables:
|
|||
- name: dockerImage
|
||||
value: 'terraform-azure-devops-aci'
|
||||
- name: terraformVersion
|
||||
value: 0.14.4
|
||||
value: 1.3
|
||||
- name: vmImage
|
||||
value: ubuntu-18.04
|
||||
value: ubuntu-latest
|
||||
- name: serviceConnection
|
||||
value: "terraform-azure-devops-aci"
|
||||
|
||||
|
|
43
main.tf
43
main.tf
|
@ -30,22 +30,6 @@ locals {
|
|||
|
||||
# Linux Agents - deployed only if variable linux_agents_configuration.count > 0
|
||||
|
||||
resource "azurerm_network_profile" "linux_network_profile" {
|
||||
count = var.enable_vnet_integration ? var.linux_agents_configuration.count : 0
|
||||
name = "linuxnetprofile${count.index}"
|
||||
location = var.location
|
||||
resource_group_name = var.create_resource_group ? azurerm_resource_group.rg[0].name : data.azurerm_resource_group.rg[0].name
|
||||
|
||||
container_network_interface {
|
||||
name = "linuxnic${count.index}"
|
||||
|
||||
ip_configuration {
|
||||
name = "linuxip${count.index}"
|
||||
subnet_id = data.azurerm_subnet.subnet[0].id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_container_group" "linux-container-group" {
|
||||
count = var.linux_agents_configuration.count
|
||||
name = "${var.linux_agents_configuration.agent_name_prefix}-${count.index}"
|
||||
|
@ -53,7 +37,7 @@ resource "azurerm_container_group" "linux-container-group" {
|
|||
resource_group_name = var.create_resource_group ? azurerm_resource_group.rg[0].name : data.azurerm_resource_group.rg[0].name
|
||||
ip_address_type = var.enable_vnet_integration ? "Private" : "Public"
|
||||
os_type = "Linux"
|
||||
network_profile_id = var.enable_vnet_integration ? azurerm_network_profile.linux_network_profile[count.index].id : null
|
||||
subnet_ids = var.enable_vnet_integration ? [data.azurerm_subnet.subnet[0].id] : null
|
||||
|
||||
container {
|
||||
name = "${var.linux_agents_configuration.agent_name_prefix}-${count.index}"
|
||||
|
@ -112,26 +96,19 @@ resource "azurerm_container_group" "linux-container-group" {
|
|||
identity_ids = var.linux_agents_configuration.user_assigned_identity_ids
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Windows Agents - deployed only if variable windows_agents_configuration.count > 0
|
||||
|
||||
resource "azurerm_network_profile" "windows_network_profile" {
|
||||
count = var.enable_vnet_integration ? var.windows_agents_configuration.count : 0
|
||||
name = "windowsnetprofile${count.index}"
|
||||
location = var.location
|
||||
resource_group_name = var.create_resource_group ? azurerm_resource_group.rg[0].name : data.azurerm_resource_group.rg[0].name
|
||||
|
||||
container_network_interface {
|
||||
name = "windowsnic${count.index}"
|
||||
|
||||
ip_configuration {
|
||||
name = "windowsip${count.index}"
|
||||
subnet_id = data.azurerm_subnet.subnet[0].id
|
||||
dynamic "dns_config" {
|
||||
for_each = var.dns_config == null ? [] : [1]
|
||||
content {
|
||||
nameservers = var.dns_config.nameservers
|
||||
search_domains = var.dns_config.search_domains
|
||||
options = var.dns_config.options
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Windows Agents - deployed only if variable windows_agents_configuration.count > 0
|
||||
|
||||
resource "azurerm_container_group" "windows-container-group" {
|
||||
count = var.windows_agents_configuration.count
|
||||
name = "${var.windows_agents_configuration.agent_name_prefix}-${count.index}"
|
||||
|
@ -139,7 +116,7 @@ resource "azurerm_container_group" "windows-container-group" {
|
|||
resource_group_name = var.create_resource_group ? azurerm_resource_group.rg[0].name : data.azurerm_resource_group.rg[0].name
|
||||
ip_address_type = var.enable_vnet_integration ? "Private" : "Public"
|
||||
os_type = "Windows"
|
||||
network_profile_id = var.enable_vnet_integration ? azurerm_network_profile.windows_network_profile[count.index].id : null
|
||||
subnet_ids = var.enable_vnet_integration ? [data.azurerm_subnet.subnet[0].id] : null
|
||||
|
||||
container {
|
||||
name = "${var.windows_agents_configuration.agent_name_prefix}-${count.index}"
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 2.0"
|
||||
version = ">= 3.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 2.0"
|
||||
version = ">= 3.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 2.0"
|
||||
version = ">= 3.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 2.0"
|
||||
version = ">= 3.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 2.0"
|
||||
version = ">= 3.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ terraform {
|
|||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 2.0"
|
||||
version = ">= 3.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
variables.tf
12
variables.tf
|
@ -108,4 +108,14 @@ variable "image_registry_credential" {
|
|||
password = "",
|
||||
server = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "dns_config" {
|
||||
type = object({
|
||||
nameservers = list(string),
|
||||
search_domains = optional(list(string))
|
||||
options = optional(list(string))
|
||||
})
|
||||
description = "(Optional) The DNS config information for a container group."
|
||||
default = null
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче