Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

rendered_docker_compose differs from original one #101

Open
M1strall opened this issue Dec 6, 2019 · 2 comments
Open

rendered_docker_compose differs from original one #101

M1strall opened this issue Dec 6, 2019 · 2 comments

Comments

@M1strall
Copy link

M1strall commented Dec 6, 2019

Hi there,
It seems I've caught an issue with some interpolation of docker-compose that is done by rancher provider. I'm getting docker-compose.yml row:
tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
replaced with:
tag: <no value>/<no value>/<no value>

To comment, this expression is not supposed to be interpolated, but preserved "as is", since this is a Splunk-driver expression.

Terraform Version

Terraform v0.11.14

Affected Resource(s)

docker-compose.yml

Terraform Configuration Files

resource "rancher_stack" "my-api" {
  name = "my-api"
  description = "API Stack"
  environment_id = "${var.rancher_environment_id}"
  start_on_create = "true"
  finish_upgrade = "true"
  docker_compose = "${file("${path.module}/docker-compose-api.yml")}"
  rancher_compose = "${file("${path.module}/rancher-compose-api.yml")}"
  scope = "user"

docker-compose.yml

version: '2'
services:
  my-api:
   #part of compose ommited for breavity
     logging:
       driver: splunk
       options:
        #some splunk env variables
         splunk-token: ${TOKEN_SPLUNK}
         splunk-url: 'https://input.mysplunk.com'
         tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"

Expected Behavior

Docker-compose.yml should've been applied "as specified" for Rancher stack

Actual Behavior

Actually applied docker compose (showing up in rendered_docker_compose: "" => "" in diff) looks like this:

version: '2'
services:
  my-api:
   #part of compose ommited for breavity
     logging:
       driver: splunk
       options:
        #some splunk env variables
         splunk-token: ${TOKEN_SPLUNK}
         splunk-url: 'https://input.mysplunk.com'
         tag: <no value>/<no value>/<no value>

Steps to Reproduce

  1. terraform apply
@raphink
Copy link
Contributor

raphink commented Jan 14, 2020

I don't see why that would happen, as we do not interpolate this string. Is it the Rancher export action that causes it to be interpreted maybe?

@greenu
Copy link

greenu commented Mar 20, 2020

Try to use go template's raw string:

tag: "{{`{{.ImageName}}`}}/{{`{{.Name}}`}}/{{`{{.ID}}`}}"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants