Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Templating Functions & HCL Variables for Artifacts, Deploys #757

Merged
merged 29 commits into from
Nov 12, 2020
Merged

Conversation

mitchellh
Copy link
Contributor

This introduces two major features (related):

  • A set of a template-prefixed HCL functions that template files or directories with the currently available HCL variables.
  • Artifact, deploy HCL variables for registry, deploy, and release stanzas. You can use this to reference information about the result of the prior operation.

This PR temporarily disables auth checks completely. We will add these again at runtime in a future PR, prior to 0.2.0.

Depends on hashicorp/waypoint-plugin-sdk#5 and will update go.mod after merging that.

Example

app "web" {
  build {
    use "docker" {
      dockerfile = templatefile("${path.app}/Dockerfile.prod", {
        custom_var = "hello"
      })
    }

    registry {
      use "docker" {
        image = artifact.image
        tag = gitrefpretty()
      }
    }
  }
  
  # ...
}

@mitchellh mitchellh added this to the 0.2.0 milestone Nov 5, 2020
@github-actions github-actions bot added the core label Nov 5, 2020
builtin/docker/copy.go Outdated Show resolved Hide resolved
Copy link
Contributor

@krantzinator krantzinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting 🎉

Copy link
Contributor

@evanphx evanphx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a biggy! All looks good, though it's hard to follow some of the changes, like I wasn't sure why all the template functions don't take a basedir anymore? I must have missed something in the reading where that basedir is coming from now. Maybe it's that the base dir is being applied to path elsewhere now?

internal/core/eval_context.go Outdated Show resolved Hide resolved
@mitchellh mitchellh merged commit 718841a into main Nov 12, 2020
@mitchellh mitchellh deleted the f-template branch November 12, 2020 23:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants