From 0181c4e2d97fead2a80c7e6c9bc09d6991ca70ee Mon Sep 17 00:00:00 2001 From: Leon <82407168+sed-i@users.noreply.github.com> Date: Tue, 11 Jul 2023 00:52:51 -0400 Subject: [PATCH] Update website/docs/language/resources/provisioners/syntax.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> --- website/docs/language/resources/provisioners/syntax.mdx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/website/docs/language/resources/provisioners/syntax.mdx b/website/docs/language/resources/provisioners/syntax.mdx index 7b8bcbb4b1..771673961d 100644 --- a/website/docs/language/resources/provisioners/syntax.mdx +++ b/website/docs/language/resources/provisioners/syntax.mdx @@ -97,11 +97,9 @@ remote access credentials to be provided. ### Provisioning files using cloud-config -Under some circumstances it may be feasible to -[yamlencode](https://www.terraform.io/language/functions/yamlencode) your entire -[cloud-config](https://registry.terraform.io/providers/hashicorp/cloudinit/latest/docs) -file. In that case you could use the `write_files` section in place of file -provisioners. For example: +You can add the [`cloudinit_config`](https://registry.terraform.io/providers/hashicorp/cloudinit/latest/docs) data source to your Terraform configuration and specify the files you want to provision as `text/cloud-config` content. The `cloudinit_config` data source renders multi-part MIME configurations for use with [cloud-init](https://cloudinit.readthedocs.io/en/latest/). Pass the files in the `content` field as YAML-encoded configurations using the `write_files` block. + +In the following example, the `my_cloud_config` data source specifies a `text/cloud-config` MIME part named `cloud.conf`. The `part.content` field is set to [`yamlencode`](/terraform/language/functions/yamlencode), which encodes the `write_files` JSON object as YAML so that the system can provision the referenced files. ```hcl data "cloudinit_config" "my_cloud_config" {