Giter VIP home page Giter VIP logo

Comments (6)

apparentlymart avatar apparentlymart commented on August 29, 2024 2

Hi @phreddrick,

We'll investigate the weird issue here... it looks like the % is escaping the ${ in a similar way that $${ would work, as a side effect of the new 2.0.0 feature allowing %{...} sequences that can themselves be escaped as %%{...}. That is, I think the escape handling is incorrectly permitting mixtures of % and $ rather than requiring two consecutive identical characters.

In the mean time, if you do not wish to pin your provider version back to 1.0.0 I think you can work around this by including the percent sign in the expression somehow. For example:

${join("", ["%", metagroup])} ALL=(ALL:ALL) ALL

from terraform-provider-template.

phreddrick avatar phreddrick commented on August 29, 2024

Thanks for the workaround. It didn't occur to me to use one of the builtin functions like that.

from terraform-provider-template.

phreddrick avatar phreddrick commented on August 29, 2024

Turns out the work-around doesn't work for terraform 0.11.11. I get:

data.template_file.sudoers: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

* data.template_file.sudoers: 1 error(s) occurred:

* data.template_file.sudoers: data.template_file.sudoers: failed to render : <template_file>:3,1-1: Invalid character; This character is not used within the language., and 1 other diagnostic(s)

when I use the example you gave above.

from terraform-provider-template.

phreddrick avatar phreddrick commented on August 29, 2024

So the following workaround worked for me with both 1.0.0 and 2.0.0:

send in "%" as a variable called percent, then the template file looks like:

# Give ${metagroup} sudo access
${join("", list(percent, metagroup))} ALL=(ALL:ALL) ALL

from terraform-provider-template.

apparentlymart avatar apparentlymart commented on August 29, 2024

Sorry, yes, the workaround I suggested was intended for provider 2.0.0. Provider 1.0.0 shouldn't need a workaround at all because it doesn't yet have the %{...} control sequence syntax that led to this parser bug.

However, if you wish to write configuration that works for both, the list(...) function is a good way to do that, since it's supported as an alias of [ ... ] for backward-compatibility.

from terraform-provider-template.

phreddrick avatar phreddrick commented on August 29, 2024

yeah, I have to support both plugin's at the moment. At any rate, the big surprise to me was that I couldn't have the literal string "%" in the join, I had to pass it in as a variable

from terraform-provider-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.