Skip to content

Commit 8955dc7

Browse files
committed
fix(cloudinit): remove the deprecated template provider
1 parent 2034d1f commit 8955dc7

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

.terraform.lock.hcl

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudinit.tf

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
# Update the Cloud Init template
2-
data "template_file" "template" {
3-
template = file("./cloudinit/template.yml")
4-
5-
vars = {
1+
locals {
2+
cloudinit = templatefile("${path.root}/cloudinit/template.tftpl", {
63
user = var.instance_os_user
74
vscode_version = var.vscode_version
8-
}
5+
})
96
}
107

118
# Generate the Cloud Init config file
12-
data "template_cloudinit_config" "cloudinit" {
13-
gzip = false
14-
base64_encode = false
9+
data "cloudinit_config" "cloudinit" {
1510

16-
# Configure the instance & Instance VSCode Server
11+
# Configure the instance + install VSCode Server
1712
part {
1813
filename = "init.cfg"
1914
content_type = "text/cloud-config"
20-
content = data.template_file.template.rendered
15+
content = local.cloudinit
2116
}
2217
}

instance.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ resource "oci_core_instance" "instance" {
6666

6767
metadata = {
6868
ssh_authorized_keys = tls_private_key.default[0].public_key_openssh
69-
user_data = base64encode(data.template_cloudinit_config.cloudinit.rendered)
69+
user_data = data.cloudinit_config.cloudinit.rendered
7070
}
7171

7272
preemptible_instance_config {

versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ terraform {
66
source = "oracle/oci"
77
version = "4.72.0"
88
}
9-
template = {
10-
source = "hashicorp/template"
9+
cloudinit = {
10+
source = "hashicorp/cloudinit"
1111
version = "2.2.0"
1212
}
1313
null = {

0 commit comments

Comments
 (0)