A little update and some Terraform goodies

data "template_file" "oracle_template" {
template = file("${path.module}/scripts/operator.template.sh")
vars = {
ol = var.operating_system_version
}
count = (var.create_operator == true) ? 1 : 0
}
data "template_file" "oracle_cloud_init_file" {
template = file("${path.module}/cloudinit/operator.template.yaml")
vars = {
operator_sh_content = base64gzip(data.template_file.oracle_template[0].rendered)
operator_upgrade = var.operator_upgrade
timezone = var.timezone
}
count = (var.create_operator == true) ? 1 : 0
}
# cloud init for operator
data "template_cloudinit_config" "operator" {
gzip = true
base64_encode = true
part {
filename = "operator.yaml"
content_type = "text/cloud-config"
content = data.template_file.oracle_cloud_init_file[0].rendered
}
count = var.create_operator == true ? 1 : 0
}
data "template_cloudinit_config" "operator" {
gzip = true
base64_encode = true
part {
filename = "operator.yaml"
content_type = "text/cloud-config"
content = templatefile(
"${path.module}/cloudinit/operator.template.yaml", {
operator_sh_content = base64gzip(
templatefile("${path.module}/scripts/operator.template.sh",
{
ol = var.operating_system_version
}
)
)
operator_upgrade = var.operator_upgrade
timezone = var.timezone
}
)
}
count = var.create_operator == true ? 1 : 0
}
data "cloudinit_config" "foo" {
gzip = false
base64_encode = false
part {
content_type = "text/x-shellscript"
content = "baz"
}
}
//locals:
operator_template = "${path.module}/cloudinit/operator.template.yaml"
operator_script_template = base64gzip(
templatefile("${path.module}/scripts/operator.template.sh",
{
ol = var.operating_system_version
}
)
)
data "template_cloudinit_config" "operator" {
gzip = true
base64_encode = true
part {
filename = "operator.yaml"
content_type = "text/cloud-config"
content = templatefile(
local.operator_template, {
operator_sh_content = local.operator_script_template,
operator_timezone = var.operator_timezone,
upgrade_operator = var.upgrade_operator,
}
)
}
count = var.create_operator == true ? 1 : 0
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store