Skip to content

Commit a4568c5

Browse files
committed
Fix CloudInit doc format and give better example
1 parent 3701342 commit a4568c5

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

website/source/docs/providers/template/r/cloudinit_config.html.markdown

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,42 @@ Renders a multi-part cloud-init config from source files.
1515
```
1616
# Render a part using a `template_file`
1717
resource "template_file" "script" {
18-
template = "${file("${path.module}/init.tpl")}"
18+
template = "${file("${path.module}/init.tpl")}"
1919
20-
vars {
21-
consul_address = "${aws_instance.consul.private_ip}"
22-
}
20+
vars {
21+
consul_address = "${aws_instance.consul.private_ip}"
22+
}
2323
}
2424
2525
# Render a multi-part cloudinit config making use of the part
2626
# above, and other source files
2727
resource "template_cloudinit_config" "config" {
28-
gzip = true
29-
base64_encode = true
30-
31-
# Setup hello world script to be called by the cloud-config
32-
part {
33-
filename = "init.cfg"
34-
content_type = "text/part-handler"
35-
content = "${template_file.script.rendered}"
36-
}
37-
38-
part {
39-
content_type = "text/x-shellscript"
40-
content = "baz"
41-
}
42-
43-
part {
44-
content_type = "text/x-shellscript"
45-
content = "ffbaz"
46-
}
28+
gzip = true
29+
base64_encode = true
30+
31+
# Setup hello world script to be called by the cloud-config
32+
part {
33+
filename = "init.cfg"
34+
content_type = "text/part-handler"
35+
content = "${template_file.script.rendered}"
36+
}
37+
38+
part {
39+
content_type = "text/x-shellscript"
40+
content = "baz"
41+
}
42+
43+
part {
44+
content_type = "text/x-shellscript"
45+
content = "ffbaz"
46+
}
47+
}
48+
49+
# Start an AWS instance with the cloudinit config as user data
50+
resource "aws_instance" "web" {
51+
ami = "ami-d05e75b8"
52+
instance_type = "t2.micro"
53+
user_data = "${template_cloudinit_config.config.rendered}"
4754
}
4855
```
4956

0 commit comments

Comments
 (0)