Bug: SNAPSHOT file contains variable name as value
I was trying to run masterTestId: "TEST_DB_ADMINISTRATORS" from master-compliance-test.json.
against related rego file at https://github.com/prancer-io/prancer-compliance-test/blob/master/azure/terraform/dbadministrators.rego
After generating of the related snapshot file for https://github.com/prancer-io/prancer-terramerra/tree/master/azure/sql_servers
I did saw azurerm_sql_active_directory_administrator contains server_name property value as "${module.sqlServers.sqlserver_name}"
{
"type": "azurerm_sql_active_directory_administrator",
"name": "sqladadmin",
"properties": {
"server_name": "${module.sqlServers.sqlserver_name}",
"resource_group_name": "prancer-test-rg",
"login": "sqladmin",
"tenant_id": "${data.azurerm_client_config.current.tenant_id}",
"object_id": "${data.azurerm_client_config.current.object_id}",
"count": 0,
"sql_server_name": "${module.sqlServers.sqlserver_name}",
"sql_server_rg": "prancer-test-rg",
"sql_server_login": "sqladmin",
"azure_tenant_id": "${data.azurerm_client_config.current.tenant_id}",
"ad_object_id": "${data.azurerm_client_config.current.object_id}"
}
}
The server_name is hardcoded value can be found directly from https://github.com/prancer-io/prancer-terramerra/blob/master/azure/sql_servers/terraform.tfvars
Can we extract the value from there in the snapshot file during generation?
I know this server_name cannot always exist in the terraform.tfvars file but it can be hardcoded in terraform resource directly in main.tf as well.
during extraction try to find the value in main.tf if there is no terraform.tfvars available or property does not exist in that file.
Note: Full snapshot file can be found at https://github.com/prancer-io/prancer-compliance-test/issues/138