broad-zoo-34077
07/06/2022, 10:19 AMmysterious-teacher-68276
07/06/2022, 10:19 AMmammoth-apple-73256
07/06/2022, 10:19 AMmysterious-teacher-68276
07/06/2022, 10:20 AMmammoth-apple-73256
07/06/2022, 10:22 AMmysterious-teacher-68276
07/06/2022, 10:27 AMmammoth-apple-73256
07/06/2022, 10:27 AMmysterious-teacher-68276
07/06/2022, 10:28 AMazurerm_application_insights.main
but the azurerm_mssql_database
should be showing a pricemammoth-apple-73256
07/06/2022, 10:28 AMmammoth-apple-73256
07/06/2022, 10:28 AMmysterious-teacher-68276
07/06/2022, 10:29 AMazurerm_mssql_database.main
(removing any sensitive information).mysterious-teacher-68276
07/06/2022, 10:30 AMsku_name
attributemammoth-apple-73256
07/06/2022, 10:30 AMmammoth-apple-73256
07/06/2022, 10:32 AMresource "azurerm_mssql_server" "main" {
name = "bousql-${var.environment}"
resource_group_name = data.azurerm_resource_group.main.name
location = data.azurerm_resource_group.main.location
version = "12.0"
administrator_login = "sqladmin"
administrator_login_password = random_password.db_password.result
minimum_tls_version = "1.2"
public_network_access_enabled = true
identity {
type = "SystemAssigned"
}
tags = {
Environment = "${var.environment}"
}
}
resource "azurerm_mssql_server_extended_auditing_policy" "main" {
server_id = azurerm_mssql_server.main.id
log_monitoring_enabled = true
}
resource "azurerm_mssql_server_extended_auditing_policy" "testsql" {
server_id = azurerm_mssql_server.main.id
storage_endpoint = azurerm_storage_account.main.primary_blob_endpoint
# do not pass the storage account key
depends_on = [azurerm_role_assignment.audit_contributor]
}
resource "azurerm_role_assignment" "audit_contributor" {
scope = azurerm_storage_account.main.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = azurerm_mssql_server.main.identity[0].principal_id
}
resource "azurerm_mssql_database" "main" {
name = "bou-Umbraco-${var.environment}"
server_id = azurerm_mssql_server.main.id
collation = "SQL_Latin1_General_CP1_CI_AS"
sku_name = local.env-test == local.env-acc ? "S3" : "S1"
mammoth-apple-73256
07/06/2022, 10:33 AMlocals {
env-test = var.environment == "test"
env-acc = var.environment == "acc"
}
mammoth-apple-73256
07/06/2022, 10:33 AMmysterious-teacher-68276
07/06/2022, 10:36 AMmysterious-teacher-68276
07/06/2022, 10:37 AMmysterious-teacher-68276
07/06/2022, 10:43 AMresource "azurerm_mssql_server" "main" {
...
location = data.azurerm_resource_group.main.location
}
Infracost’s default behaviour is to parse the raw configuration files, and not contact any cloud providers. This has the benefit of being fast and more secure. However, we can’t evaluate data
blocks. So what’s happening here is that the azurerm_mssql_database.main
is using azurerm_mssql_server.main
to determine the region/location and because this is populated from a data
block it’s returning empty. Meaning the price lookup fails and gives a 0$.
A workaround for you is to use the --terraform-force-cli
flag which forces infracost to use Terraform binary output. This is slower but should give you a better output.
Our side we need to put in a fix to return a default location if we can’t evaluate the expressions, and then give users the option to override this. There’s an open issue here for the latter: https://github.com/infracost/infracost/issues/1796mammoth-apple-73256
07/06/2022, 11:03 AM