Giter Site home page Giter Site logo

Comments (3)

babarot avatar babarot commented on May 24, 2024

@dtan4 Thank you for your report.

One solution is using triple backquotes. I prefer this solution.

Yes, I know.
Now, I'm using backquotes for string literals.

// DefaultPlanTemplate is a default template for terraform plan
DefaultPlanTemplate = `
{{ .Title }}
{{ .Message }}
{{if .Result}}
<pre><code>{{ .Result }}
</code></pre>
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code>{{ .Body }}
</code></pre></details>
`

It's true that I'd like to use backquotes in string literals but I don't know how to use it in string literals like this:

	DefaultPlanTemplate = `
{{ .Title }}
{{ .Message }}
{{if .Result}}
```
{{ .Result }}
```
{{end}}
<details><summary>Details (Click me)</summary>
```
{{ .Body }}
```
</details>
`

How can I use triple backquotes in backquotes (string literals)?

from tfnotify.

dtan4 avatar dtan4 commented on May 24, 2024

Yes, triple backquotes cannot be written in raw string literal.

We can concatenate both interpreted string literals and raw string literals.
So how about this:

	DefaultPlanTemplate = `
{{ .Title }}

{{ .Message }}

{{if .Result}}

` + "```" + `
{{ .Result }}
` + "```" + `

{{end}}

<details><summary>Details (Click me)</summary>

` + "```" + `
{{ .Body }}
` + "```" + `

</details>
`

from tfnotify.

chroju avatar chroju commented on May 24, 2024

Hi. I also suffer from the same problem with the template examples in README.md . This issue would be solved if an empty line is added after the </summary> tag. Show an example below.

Add no empty lines

Details (Click me)
 Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_instance.example: Refreshing state...


An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create

Terraform will perform the following actions:

aws_instance.example will be created

+ resource "aws_instance" "example" {
+ instance_type = "t3.micro"
}

Plan: 1 to add, 0 to change, 0 to destroy.


Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

Add an empty line

Details (Click me)
 Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_instance.example: Refreshing state...

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_instance.example will be created
  + resource "aws_instance" "example" {
      + instance_type  = "t3.micro"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.



Pull request #45 is to fix this problem in the all template examples and the default templates within this repository. Please look at it.

from tfnotify.

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.