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

Add ability to reference waypoint.hcl variables between eachother #1382

Merged
merged 12 commits into from
Apr 29, 2021

Conversation

evanphx
Copy link
Contributor

@evanphx evanphx commented Apr 22, 2021

This change adds the ability refer to other waypoint.hcl defined variables using HCL templating. Additionally, it adds a new class of variable called internal variables. These variables are not exposed to the application and are designed to be composed into other variables.

This functionally fully supports completing dynamic variables into non-dynamic ones, allowing for a better where internal dynamic variables are composed into a env variables:

config {
  internal = {
    dbhost = configdynamic("terraform-cloud", {
       organization = "foocorp",
       workspace = "production",
       output = "dbhost"
    })
  }

  env = {
    DATABASE_URL = "postgresql://${config.internal.dbhost}"
  }
}

@evanphx evanphx requested a review from a team April 22, 2021 23:04
@github-actions github-actions bot added the core label Apr 22, 2021
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

This looks really good! Relatively simple overall, at least compared to what I thought would be required.

I think the one big question I have is how escaping works in this scenario (i.e. I literally want ${foo} in my value). This might just be handled by internal/pkg/partial. If so, I don't see any tests for it and I think we should definitely cover escaping tests at most levels.

@evanphx evanphx requested a review from mitchellh April 29, 2021 20:24
@@ -0,0 +1,3 @@
```release-note:feature
config: Add ability to define internal variables and compose variables together via templating
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, we may want to turn this one into a bold heading style (see 0.3 or 0.2 or w/e changelog) but we can do that human-powered when we do a major release?

Copy link
Member

Choose a reason for hiding this comment

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

You should be able to use markdown here and go-changelog will respect it, so adding the * should be fine to do here if we want to bold it

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, yeah worth considering, I think this is a big feature.

@evanphx evanphx merged commit b0f170d into main Apr 29, 2021
@evanphx evanphx deleted the feature/config-internal branch April 29, 2021 22:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants