Skip to content

Commit

Permalink
fix: Upgrade from azurerm (#38)
Browse files Browse the repository at this point in the history
* fix: Upgrade from azurerm

* fix nat gateway

* new version

* fix

Co-authored-by: pasqualedevita <>
  • Loading branch information
pasqualedevita authored Jan 19, 2023
1 parent 4f46be9 commit c86cf8e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ Storage account

| Name | Source | Version |
|------|--------|---------|
| <a name="module_cdn_storage_account"></a> [cdn\_storage\_account](#module\_cdn\_storage\_account) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account | v3.7.0 |
| <a name="module_cdn_storage_account"></a> [cdn\_storage\_account](#module\_cdn\_storage\_account) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account | v3.13.0 |

## Resources

Expand Down
2 changes: 1 addition & 1 deletion cdn/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**/
module "cdn_storage_account" {

source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account?ref=v3.7.0"
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account?ref=v3.13.0"

name = replace("${var.prefix}-${var.name}-sa", "-", "")
account_kind = var.storage_account_kind
Expand Down
6 changes: 3 additions & 3 deletions function_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ See [Generic resorce migration](../docs/MIGRATION_GUIDE_GENERIC_RESOURCES.md)

| Name | Source | Version |
|------|--------|---------|
| <a name="module_storage_account"></a> [storage\_account](#module\_storage\_account) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account | v3.7.0 |
| <a name="module_storage_account_durable_function"></a> [storage\_account\_durable\_function](#module\_storage\_account\_durable\_function) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account | v3.7.0 |
| <a name="module_storage_account_durable_function_management_policy"></a> [storage\_account\_durable\_function\_management\_policy](#module\_storage\_account\_durable\_function\_management\_policy) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_management_policy | v3.7.0 |
| <a name="module_storage_account"></a> [storage\_account](#module\_storage\_account) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account | v3.13.0 |
| <a name="module_storage_account_durable_function"></a> [storage\_account\_durable\_function](#module\_storage\_account\_durable\_function) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account | v3.13.0 |
| <a name="module_storage_account_durable_function_management_policy"></a> [storage\_account\_durable\_function\_management\_policy](#module\_storage\_account\_durable\_function\_management\_policy) | git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_management_policy | v3.13.0 |

## Resources

Expand Down
6 changes: 3 additions & 3 deletions function_app/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#tfsec:ignore:azure-storage-default-action-deny
module "storage_account" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account?ref=v3.7.0"
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account?ref=v3.13.0"

name = coalesce(var.storage_account_name, format("%sst", replace(var.name, "-", "")))
account_kind = var.storage_account_info.account_kind
Expand All @@ -18,7 +18,7 @@ module "storage_account" {
module "storage_account_durable_function" {
count = var.internal_storage.enable ? 1 : 0

source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account?ref=v3.7.0"
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_account?ref=v3.13.0"

name = coalesce(var.storage_account_durable_name, format("%ssdt", replace(var.name, "-", "")))
account_kind = var.storage_account_info.account_kind
Expand Down Expand Up @@ -60,7 +60,7 @@ resource "azurerm_storage_container" "internal_container" {

module "storage_account_durable_function_management_policy" {
count = length(local.internal_containers) == 0 ? 0 : 1
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_management_policy?ref=v3.7.0"
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//storage_management_policy?ref=v3.13.0"

storage_account_id = module.storage_account_durable_function[0].id

Expand Down
4 changes: 1 addition & 3 deletions load_balancer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ resource "azurerm_lb_probe" "this" {
for_each = var.lb_probe

name = format("%s-probe", each.key)
resource_group_name = var.resource_group_name
loadbalancer_id = azurerm_lb.this.id
protocol = each.value.protocol
port = each.value.port
Expand All @@ -72,14 +71,13 @@ resource "azurerm_lb_rule" "this" {
for_each = var.lb_port

name = format("%s-rule", each.key)
resource_group_name = var.resource_group_name
loadbalancer_id = azurerm_lb.this.id
protocol = each.value.protocol
frontend_port = each.value.frontend_port
backend_port = each.value.backend_port
frontend_ip_configuration_name = var.frontend_name
enable_floating_ip = false
backend_address_pool_id = azurerm_lb_backend_address_pool.this[each.value.backend_pool_name].id
backend_address_pool_ids = [azurerm_lb_backend_address_pool.this[each.value.backend_pool_name].id]
idle_timeout_in_minutes = 5
probe_id = each.value.probe_name != null ? azurerm_lb_probe.this[each.value.probe_name].id : null
}
2 changes: 1 addition & 1 deletion nat_gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ No modules.
| <a name="input_sku_name"></a> [sku\_name](#input\_sku\_name) | The SKU which should be used. At this time the only supported value is Standard. | `string` | `"Standard"` | no |
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of subnets id to which associate the nat gateway | `list(string)` | `[]` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(any)` | n/a | yes |
| <a name="input_zone"></a> [zone](#input\_zone) | Availability zone where the NAT Gateway should be provisioned. | `string` | `"1"` | no |
| <a name="input_zones"></a> [zones](#input\_zones) | Availability zone where the NAT Gateway should be provisioned. | `list(number)` | <pre>[<br> 1,<br> 2,<br> 3<br>]</pre> | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions nat_gateway/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "azurerm_public_ip" "this" {
resource_group_name = var.resource_group_name
allocation_method = "Static"
sku = "Standard"
availability_zone = var.zone
zones = var.zones
}

resource "azurerm_nat_gateway" "this" {
Expand All @@ -14,7 +14,7 @@ resource "azurerm_nat_gateway" "this" {
resource_group_name = var.resource_group_name
sku_name = var.sku_name
idle_timeout_in_minutes = var.idle_timeout_in_minutes
zones = [var.zone]
zones = var.zones

tags = var.tags
}
Expand Down
8 changes: 4 additions & 4 deletions nat_gateway/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ variable "location" {
type = string
}

variable "zone" {
type = string
default = "1"
variable "zones" {
type = list(number)
default = [1, 2, 3]
description = "Availability zone where the NAT Gateway should be provisioned."
}

Expand Down Expand Up @@ -42,4 +42,4 @@ variable "public_ips_count" {

variable "tags" {
type = map(any)
}
}

0 comments on commit c86cf8e

Please sign in to comment.