Skip to content

Commit 25a6da8

Browse files
author
Uros Randelovic
committed
Merge remote-tracking branch 'origin/master' into sql-managed-instance
2 parents 66f805b + f0587e9 commit 25a6da8

File tree

16 files changed

+397
-30
lines changed

16 files changed

+397
-30
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Contributing
2-
This project welcomes contributions and suggestions.
3-
4-
## Modules
5-
Module summary
6-
[Module contribution guide](./module/CONTRIBUTE.md)
7-
8-
## Providers
9-
Provider summary
10-
[Provider contribution guide](./provider/CONTRIBUTE.md)
11-
12-
# Contributing
13-
14-
This project welcomes contributions and suggestions. Most contributions require you to agree to a
15-
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
16-
the rights to use your contribution. For details, visit https://cla.microsoft.com.
17-
18-
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
19-
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
20-
provided by the bot. You will only need to do this once across all repos using our CLA.
21-
22-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
23-
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
24-
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
1+
# Contributing
2+
This project welcomes contributions and suggestions.
3+
4+
## Modules
5+
Module summary
6+
[Module contribution guide](./module/CONTRIBUTE.md)
7+
8+
## Providers
9+
Provider summary
10+
[Provider contribution guide](./provider/CONTRIBUTE.md)
11+
12+
# Contributing
13+
14+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
15+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
16+
the rights to use your contribution. For details, visit https://cla.microsoft.com.
17+
18+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
19+
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
20+
provided by the bot. You will only need to do this once across all repos using our CLA.
21+
22+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
23+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
24+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

quickstart/101-azure-virtual-desktop/host.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ resource "azurerm_virtual_machine_extension" "vmext_dsc" {
108108

109109
settings = <<-SETTINGS
110110
{
111-
"modulesUrl": "https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Configuration_3-10-2021.zip",
111+
"modulesUrl": "https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Configuration_09-08-2022.zip",
112112
"configurationFunction": "Configuration.ps1\\AddSessionHost",
113113
"properties": {
114114
"HostPoolName":"${azurerm_virtual_desktop_host_pool.hostpool.name}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
resource "azurerm_container_group" "vote_aci" {
2+
name = "vote-aci"
3+
location = azurerm_resource_group.rg.location
4+
resource_group_name = azurerm_resource_group.rg.name
5+
ip_address_type = "public"
6+
dns_name_label = "vote-aci-${random_integer.ri.result}"
7+
os_type = "linux"
8+
9+
container {
10+
name = "vote-aci"
11+
image = "mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb"
12+
cpu = "0.5"
13+
memory = "1.5"
14+
ports {
15+
port = 80
16+
protocol = "TCP"
17+
}
18+
19+
secure_environment_variables = {
20+
"COSMOS_DB_ENDPOINT" = azurerm_cosmosdb_account.vote_cosmos_db.endpoint
21+
"COSMOS_DB_MASTERKEY" = azurerm_cosmosdb_account.vote_cosmos_db.primary_key
22+
"TITLE" = "Azure Voting App"
23+
"VOTE1VALUE" = "Cats"
24+
"VOTE2VALUE" = "Dogs"
25+
}
26+
}
27+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
resource "random_pet" "rg_name" {
2+
prefix = var.resource_group_name_prefix
3+
}
4+
5+
resource "azurerm_resource_group" "rg" {
6+
location = var.resource_group_location
7+
name = random_pet.rg_name.id
8+
}
9+
10+
resource "random_integer" "ri" {
11+
min = 10000
12+
max = 99999
13+
}
14+
15+
resource "azurerm_cosmosdb_account" "vote_cosmos_db" {
16+
name = "tfex-cosmos-db-${random_integer.ri.result}"
17+
location = azurerm_resource_group.rg.location
18+
resource_group_name = azurerm_resource_group.rg.name
19+
offer_type = "Standard"
20+
kind = "GlobalDocumentDB"
21+
22+
consistency_policy {
23+
consistency_level = "BoundedStaleness"
24+
max_interval_in_seconds = 10
25+
max_staleness_prefix = 200
26+
}
27+
28+
geo_location {
29+
location = azurerm_resource_group.rg.location
30+
failover_priority = 0
31+
}
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
output "resource_group_name" {
2+
value = azurerm_resource_group.rg.name
3+
}
4+
5+
output "cosmosdb_account_name" {
6+
value = azurerm_cosmosdb_account.vote_cosmos_db.name
7+
}
8+
9+
output "dns" {
10+
value = azurerm_container_group.vote_aci.fqdn
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = ">=0.12"
3+
4+
required_providers {
5+
azurerm = {
6+
source = "hashicorp/azurerm"
7+
version = "~>3.0"
8+
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = "~>3.0"
12+
}
13+
}
14+
}
15+
16+
provider "azurerm" {
17+
features {}
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Azure Cosmos DB in an Azure Container Instance
2+
3+
This template shows how to use Terraform to deploy an Azure Cosmos DB to Azure Container Instances.
4+
5+
## Terraform resource types
6+
7+
- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
8+
- [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group)
9+
- [random_integer](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer)
10+
- [azurerm_cosmosdb_account](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cosmosdb_account)
11+
12+
## Variables
13+
14+
| Name | Description | Default |
15+
|-|-|-|
16+
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
17+
| `resource_group_location` | Location of the resource group. | eastus |
18+
19+
## Example
20+
21+
To see how to run this example, see [Deploy an Azure Cosmos DB to Azure Container Instances](https://docs.microsoft.com/azure/developer/terraform/deploy-azure-cosmos-db-to-azure-container-instances).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "resource_group_location" {
2+
default = "eastus"
3+
description = "Location of the resource group."
4+
}
5+
6+
variable "resource_group_name_prefix" {
7+
default = "rg"
8+
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
9+
}

quickstart/101-vm-with-infrastructure/readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ This template deploys a Linux virtual machine (VM) with infrastructure that incl
2020

2121
## Variables
2222

23-
| Name | Description | Default |
24-
|-|-|
23+
| **Name** | **Description** | **Default** |
24+
|---|---|---|
2525
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
2626
| `resource_group_location` | Location of the resource group. | eastus |
2727

2828
## Example
2929

30-
To see how to run this example, see [Quickstart: Configure a Linux virtual machine in Azure using Terraform](https://docs.microsoft.com/azure/developer/terraform/create-linux-virtual-machine-with-infrastructure).
30+
To see how to run this example, see [Quickstart: Configure a Linux virtual machine in Azure using Terraform](https://docs.microsoft.com/azure/developer/terraform/create-linux-virtual-machine-with-infrastructure).
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
resource "random_pet" "rg_name" {
2+
prefix = var.resource_group_name_prefix
3+
}
4+
5+
resource "azurerm_resource_group" "rg" {
6+
location = var.resource_group_location
7+
name = random_pet.rg_name.id
8+
}
9+
10+
# Create storage account & container
11+
resource "random_string" "sa_name" {
12+
length = 12
13+
special = false
14+
upper = false
15+
}
16+
17+
resource "azurerm_storage_account" "sa" {
18+
name = random_string.sa_name.id
19+
resource_group_name = azurerm_resource_group.rg.name
20+
location = azurerm_resource_group.rg.location
21+
account_tier = "Standard"
22+
account_replication_type = "LRS"
23+
}
24+
25+
resource "azurerm_storage_container" "my_terraform_container" {
26+
name = "mycontainer"
27+
storage_account_name = azurerm_storage_account.sa.name
28+
container_access_type = "private"
29+
}
30+
31+
32+
# Create an Event Hub & Authorization Rule
33+
resource "random_pet" "eventhub_namespace_name" {
34+
prefix = var.eventhub_namespace_name_prefix
35+
}
36+
37+
resource "azurerm_eventhub_namespace" "namespace" {
38+
name = random_pet.eventhub_namespace_name.id
39+
resource_group_name = azurerm_resource_group.rg.name
40+
location = azurerm_resource_group.rg.location
41+
sku = "Basic"
42+
}
43+
44+
resource "azurerm_eventhub" "my_terraform_eventhub" {
45+
name = "myEventHub"
46+
resource_group_name = azurerm_resource_group.rg.name
47+
namespace_name = azurerm_eventhub_namespace.namespace.name
48+
partition_count = 2
49+
message_retention = 1
50+
}
51+
52+
resource "azurerm_eventhub_authorization_rule" "my_terraform_authorization_rule" {
53+
resource_group_name = azurerm_resource_group.rg.name
54+
namespace_name = azurerm_eventhub_namespace.namespace.name
55+
eventhub_name = azurerm_eventhub.my_terraform_eventhub.name
56+
name = "acctest"
57+
send = true
58+
}
59+
60+
61+
# Create an IoT Hub
62+
resource "random_pet" "iothub_name" {
63+
prefix = var.iothub_name_prefix
64+
length = 1
65+
}
66+
67+
resource "azurerm_iothub" "iothub" {
68+
name = random_pet.iothub_name.id
69+
resource_group_name = azurerm_resource_group.rg.name
70+
location = azurerm_resource_group.rg.location
71+
72+
sku {
73+
name = "S1"
74+
capacity = 1
75+
}
76+
77+
endpoint {
78+
type = "AzureIotHub.StorageContainer"
79+
connection_string = azurerm_storage_account.sa.primary_blob_connection_string
80+
name = "export"
81+
batch_frequency_in_seconds = 60
82+
max_chunk_size_in_bytes = 10485760
83+
container_name = azurerm_storage_container.my_terraform_container.name
84+
encoding = "Avro"
85+
file_name_format = "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}"
86+
}
87+
88+
endpoint {
89+
type = "AzureIotHub.EventHub"
90+
connection_string = azurerm_eventhub_authorization_rule.my_terraform_authorization_rule.primary_connection_string
91+
name = "export2"
92+
}
93+
94+
route {
95+
name = "export"
96+
source = "DeviceMessages"
97+
condition = "true"
98+
endpoint_names = ["export"]
99+
enabled = true
100+
}
101+
102+
route {
103+
name = "export2"
104+
source = "DeviceMessages"
105+
condition = "true"
106+
endpoint_names = ["export2"]
107+
enabled = true
108+
}
109+
110+
enrichment {
111+
key = "tenant"
112+
value = "$twin.tags.Tenant"
113+
endpoint_names = ["export", "export2"]
114+
}
115+
116+
cloud_to_device {
117+
max_delivery_count = 30
118+
default_ttl = "PT1H"
119+
feedback {
120+
time_to_live = "PT1H10M"
121+
max_delivery_count = 15
122+
lock_duration = "PT30S"
123+
}
124+
}
125+
126+
tags = {
127+
purpose = "testing"
128+
}
129+
}
130+
131+
#Create IoT Hub Access Policy
132+
resource "azurerm_iothub_shared_access_policy" "hub_access_policy" {
133+
name = "terraform-policy"
134+
resource_group_name = azurerm_resource_group.rg.name
135+
iothub_name = azurerm_iothub.iothub.name
136+
137+
registry_read = true
138+
registry_write = true
139+
service_connect = true
140+
}
141+
142+
# Create IoT Hub DPS
143+
resource "random_pet" "dps_name" {
144+
prefix = var.dps_name_prefix
145+
length = 1
146+
}
147+
148+
resource "azurerm_iothub_dps" "dps" {
149+
name = random_pet.dps_name.id
150+
resource_group_name = azurerm_resource_group.rg.name
151+
location = azurerm_resource_group.rg.location
152+
allocation_policy = "Hashed"
153+
154+
sku {
155+
name = "S1"
156+
capacity = 1
157+
}
158+
159+
linked_hub {
160+
connection_string = azurerm_iothub_shared_access_policy.hub_access_policy.primary_connection_string
161+
location = azurerm_resource_group.rg.location
162+
allocation_weight = 150
163+
apply_allocation_policy = true
164+
}
165+
}

0 commit comments

Comments
 (0)