Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build variables not working in post-processor #11262

Closed
Vinrobot opened this issue Sep 11, 2021 · 1 comment · Fixed by #11323
Closed

Build variables not working in post-processor #11262

Vinrobot opened this issue Sep 11, 2021 · 1 comment · Fixed by #11323

Comments

@Vinrobot
Copy link

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

Currently, it's not possible to use the variable build.name in a post-processor but it's possible to use build.ID, or at least it doesn't throw an error.
The same goes for other variables on build like Host, User or Password.

Simple example:

source "null" "first-example" {
  communicator = "none"
}
build {
  name = "step1"
  sources = ["null.first-example"]
  provisioner "shell-local" {
    # Works
    inline = ["echo ${build.name}"]
  }
  post-processor "shell-local" {
    # Error: Unsupported attribute; This object does not have an attribute named "name".
    inline = ["echo ${build.name}"]
  }
}

Use Case(s)

My use case is the following, I would like to be able to use the build.name in the filename of the generated manifest.
This way I would only have to maintain one value at one place.

build {
  name = "step1"
  sources = ["null.first-example"]

  post-processor "manifest" {
    output = "manifests/${build.name}.${source.type}.${source.name}.json"
  }
}

Potential configuration

None

Potential References

The pull request which added the variable in provisioner: #10114

@nywilken nywilken added the bug label Sep 22, 2021
@azr azr added this to the 1.7.7 milestone Oct 6, 2021
@nywilken nywilken modified the milestones: 1.7.7, 1.7.8 Oct 6, 2021
@azr azr self-assigned this Oct 11, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants