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

Recognize the new core project-level config block #379

Merged
merged 1 commit into from
Nov 1, 2022
Merged

Recognize the new core project-level config block #379

merged 1 commit into from
Nov 1, 2022

Conversation

aq17
Copy link
Contributor

@aq17 aq17 commented Oct 22, 2022

Fixes #369

@Frassle
Copy link
Member

Frassle commented Oct 23, 2022

My understanding of @AaronFriel's explanation around this was that YAML was going to stop looking at the config block directly and look at config and configSecretKeys in the run request from the engine instead.

@aq17
Copy link
Contributor Author

aq17 commented Oct 24, 2022

So YAML would use the Go SDK to do things like conf.TryInt("instanceSize") instead of the project file config block? If so, would it make sense to have a separate syntax instead of interpolated expressions to get a config value, i.e. conf.instanceSize

cc @iwahbe

@iwahbe
Copy link
Member

iwahbe commented Oct 24, 2022

We already use the go SDK to pull config values, see

case ctypes.String:
if isSecretInConfig {
v, err = config.TrySecret(e.pulumiCtx, k)
} else {
v, err = config.Try(e.pulumiCtx, k)
}

In the past, we needed to read the config to known what values to pull into scope, and what defaults to provide. If defaults will be handled for us, we can just inject config values into our scope and error (during topologicallySortedResources) when attempting to use missing values.

I don't see why changing the implementation should change the user syntax.

pkg/pulumiyaml/ast/template.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Show resolved Hide resolved
pkg/pulumiyaml/sort.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/sort.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/sort.go Outdated Show resolved Hide resolved
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

It would be great to start seeing tests for getPulumiConfNodes

pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
@iwahbe iwahbe self-requested a review October 26, 2022 00:30
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

Misclicked on approve

@aq17
Copy link
Contributor Author

aq17 commented Oct 27, 2022

For updating our examples and being able to convert YAML->PCL, we may need to parse the config block? @iwahbe

@iwahbe
Copy link
Member

iwahbe commented Oct 27, 2022

For updating our examples and being able to convert YAML->PCL, we may need to parse the config block? @iwahbe

Parsing the config block is complicated already, and will get more so when we introduce new sources of config. Even now, consider the following 3 files:

Pulumi.yaml:

name: proj
runtime: yaml
main: src/Main.yaml
config:
  prefix: 
    default: abc

Pulumi.dev.yaml:

config:
  pros:tag: tag2

src/Main.yaml:

resources:
  bucket:
    type: aws:s3:Bucket
    properties:
      bucket: ${prefix}-bucket
      tags:
        stackTag: ${tag}

I can see how we will need the information though. Right now, I think we can continue going through configuration for this. In the future we can add the ability to describe the config when converting YAML->PCL.

@Frassle
Copy link
Member

Frassle commented Oct 29, 2022

In the future we can add the ability to describe the config when converting YAML->PCL.

I think that might sync well with the ideas of code generating config types for the other languages. We should try to make sure those two things use the same language.

@aq17 aq17 force-pushed the aqiu/369 branch 2 times, most recently from ad51509 to 22b226b Compare October 31, 2022 17:36
@aq17 aq17 marked this pull request as ready for review October 31, 2022 21:03
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

I left some comments. There are a couple places to clean up, but I think its getting close.

pkg/pulumiyaml/run.go Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

I left 1 very minor nit, but LGTM!

pkg/pulumiyaml/run.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update pulumi-yaml to recognize the new core config block
3 participants