Created
March 19, 2018 01:54
-
-
Save TsuyoshiUshio/9eb84b271c9877df702e03de68c7e190 to your computer and use it in GitHub Desktop.
local exec sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cosmos DB | |
resource "azurerm_cosmosdb_account" "test" { | |
name = "${var.cosmosdb_account_name}" | |
location = "${azurerm_resource_group.test.location}" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
offer_type = "${var.cosmosdb_offer_type}" | |
consistency_policy { | |
consistency_level = "${var.cosmosdb_consistency_level}" | |
} | |
failover_policy { | |
location = "${azurerm_resource_group.test.location}" | |
priority = 0 | |
} | |
# Create Cosmos DB and Collection. It requires az command | |
# https://docs.microsoft.com/ja-jp/azure/cosmos-db/scripts/create-database-account-collections-cli?toc=%2fcli%2fazure%2ftoc.json | |
provisioner "local-exec" { | |
command = "az cosmosdb database create --name ${var.cosmosdb_account_name} --db-name ${var.stream_analytics_cosmosdb_name} --resource-group ${azurerm_resource_group.test.name}" | |
} | |
provisioner "local-exec" { | |
command = "az cosmosdb collection create --collection-name ${var.stream_analytics_cosmosdb_collection_name_pattern} --name ${var.cosmosdb_account_name} --db-name ${var.stream_analytics_cosmosdb_name} --resource-group ${azurerm_resource_group.test.name} --partition-key-path ${var.stream_analytics_cosmosdb_partition_key}" | |
} | |
tags { | |
environment = "${var.environment}" | |
} | |
depends_on = ["azurerm_resource_group.test"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment