export function aciConfig()

in src/constants.ts [14:63]


export function aciConfig(resourceGroup: string, aciName: string, aciGroup: string, storageAccountName: string, storageAccountShare: string, location: string, testContainer: string, projectName: string): string {
    let TFConfiguration: string;
    // TODO - add a check on the location where ACI is available - if (['westus', eastus].indexOf(location) == -1) {

    TFConfiguration = `variable "location" {
        default = "${location}"
    }

variable "storage_account_key" { }

resource "azurerm_resource_group" "TFTest" {
    name     = "${resourceGroup}"
    location = "${location}"
}
resource "azurerm_container_group" "TFTest" {
    depends_on = ["azurerm_resource_group.TFTest"]
    name = "${aciGroup}"
    location = "${location}"
    resource_group_name = "${resourceGroup}"
    ip_address_type = "public"
    os_type = "linux"
    restart_policy = "Never"

    container {
        name = "${aciName}"
        image = "${testContainer}"
        cpu = "1"
        memory = "2"
        port = "80"

        environment_variables {
            "ARM_TEST_LOCATION"="${location}"
            "ARM_TEST_LOCATION_ALT"="${location}"
        }

        command = "/bin/bash -c '/module/${projectName}/.TFTesting/containercmd.sh'"

        volume {
            name = "module"
            mount_path = "/module"
            read_only = false
            share_name = "${storageAccountShare}"
            storage_account_name = "${storageAccountName}"
            storage_account_key = "\${var.storage_account_key}"
        }
    }
}`;

    return TFConfiguration;
}