Quantcast
Channel: Terraform - HashiCorp Discuss
Viewing all articles
Browse latest Browse all 11427

How can I create a destination file form a rendered template?

$
0
0

Hi, I want to create an installation file from a rendered template but it creates with incorrect content. Can anyone assist?

  metadata = {
    user_data = var.instance_user_data
  }

  provisioner "file" {
  connection {
    X
  }
    content     = var.instance_user_data
    destination = "/tmp/install.sh"
  }

  provisioner "remote-exec" {
  connection {
    X
  }

  inline = [
    "set -x",
    "bash 'sudo /tmp/install.sh'"
    ]
  }

/tmp/install.sh is created but does not have expected content, I expect

#! /bin/bash

if [[ "proxy-server:80" != "" ]] ; then
mkdir -p /etc/systemd/system/crio.service.d/
tee /etc/systemd/system/crio.service.d/proxy.conf <<EOF
[Service]
Environment="http_proxy=proxy-server:80"
EOF
fi

if [ "8" -ge 8 ]; then
  dnf install -y xyx123
else
  yum install -y xyz123
fi

but instead it has.

IyEgL2Jpbi9iYXNoCg.........GUtY2EtdHJ1c3QgZXh0cmFjdAo=

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 11427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>