File tree 2 files changed +21
-6
lines changed
examples/templates/azure-linux
2 files changed +21
-6
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ terraform {
6
6
azurerm = {
7
7
source = " hashicorp/azurerm"
8
8
}
9
+ cloudinit = {
10
+ source = " hashicorp/cloudinit"
11
+ }
9
12
}
10
13
}
11
14
@@ -167,12 +170,24 @@ module "jetbrains_gateway" {
167
170
168
171
locals {
169
172
prefix = " coder-${ data . coder_workspace_owner . me . name } -${ data . coder_workspace . me . name } "
173
+ }
174
+
175
+ data "cloudinit_config" "user_data" {
176
+ gzip = false
177
+ base64_encode = true
170
178
171
- userdata = templatefile (" cloud-config.yaml.tftpl" , {
172
- username = " coder" # Ensure this user/group does not exist in your VM image
173
- init_script = base64encode (coder_agent. main . init_script )
174
- hostname = lower (data. coder_workspace . me . name )
175
- })
179
+ boundary = " //"
180
+
181
+ part {
182
+ filename = " cloud-config.yaml"
183
+ content_type = " text/cloud-config"
184
+
185
+ content = templatefile (" ${ path . module } /cloud-init/cloud-config.yaml.tftpl" , {
186
+ username = " coder" # Ensure this user/group does not exist in your VM image
187
+ init_script = base64encode (coder_agent. main . init_script )
188
+ hostname = lower (data. coder_workspace . me . name )
189
+ })
190
+ }
176
191
}
177
192
178
193
resource "azurerm_resource_group" "main" {
@@ -275,7 +290,7 @@ resource "azurerm_linux_virtual_machine" "main" {
275
290
sku = " 20_04-lts-gen2"
276
291
version = " latest"
277
292
}
278
- user_data = base64encode (local . userdata )
293
+ user_data = data . cloudinit_config . user_data . rendered
279
294
280
295
tags = {
281
296
Coder_Provisioned = " true"
You can’t perform that action at this time.
0 commit comments