Skip to content

Commit 8fb7832

Browse files
authored
feat(examples/templates/azure-windows): add azure region and windows-rdp modules (coder#15516)
1 parent c41254b commit 8fb7832

File tree

1 file changed

+23
-25
lines changed
  • examples/templates/azure-windows

1 file changed

+23
-25
lines changed

examples/templates/azure-windows/main.tf

+23-25
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,31 @@ provider "azurerm" {
1313
features {}
1414
}
1515

16-
provider "coder" {
16+
provider "coder" {}
17+
data "coder_workspace" "me" {}
18+
19+
# See https://registry.coder.com/modules/azure-region
20+
module "azure_region" {
21+
source = "registry.coder.com/modules/azure-region/coder"
22+
23+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
24+
version = ">= 1.0.0"
25+
26+
default = "eastus"
1727
}
1828

19-
data "coder_workspace" "me" {}
29+
# See https://registry.coder.com/modules/windows-rdp
30+
module "windows_rdp" {
31+
source = "registry.coder.com/modules/windows-rdp/coder"
2032

21-
data "coder_parameter" "location" {
22-
description = "What location should your workspace live in?"
23-
display_name = "Location"
24-
name = "location"
25-
default = "eastus"
26-
mutable = false
27-
option {
28-
value = "eastus"
29-
name = "East US"
30-
}
31-
option {
32-
value = "centralus"
33-
name = "Central US"
34-
}
35-
option {
36-
value = "southcentralus"
37-
name = "South Central US"
38-
}
39-
option {
40-
value = "westus2"
41-
name = "West US 2"
42-
}
33+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
34+
version = ">= 1.0.0"
35+
36+
admin_username = local.admin_username
37+
admin_password = random_password.admin_password.result
38+
39+
agent_id = resource.coder_agent.main.id
40+
resource_id = null # Unused, to be removed in a future version
4341
}
4442

4543
data "coder_parameter" "data_disk_size" {
@@ -77,7 +75,7 @@ locals {
7775

7876
resource "azurerm_resource_group" "main" {
7977
name = "${local.prefix}-${data.coder_workspace.me.id}"
80-
location = data.coder_parameter.location.value
78+
location = module.azure_region.value
8179
tags = {
8280
Coder_Provisioned = "true"
8381
}

0 commit comments

Comments
 (0)