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

Inject secrets from provider:"secret" tags #252

Merged
merged 7 commits into from
Jul 26, 2024

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Jul 24, 2024

This PR add explicit secret injection to infer. This is necessary for explicit providers in YAML, which does not correctly apply schema based secrets to provider config. This is what the bridge does.

To guard against misbehaved or partially implemented SDKs, I have also added explicit secret injection to resources.

Fixes #251

@iwahbe iwahbe self-assigned this Jul 24, 2024
@iwahbe iwahbe marked this pull request as ready for review July 24, 2024 18:47
@iwahbe iwahbe requested review from thomas11, blampe and a team and removed request for thomas11 July 24, 2024 18:50
iwahbe added a commit that referenced this pull request Jul 24, 2024
Following up on #252, this allows `DefaultCheck` to safely and accurately handle secrets
application. The new signature for `DefaultCheck` is easier to extend without additional
breaking changes. The downside to this design is that this makes `DefaultCheck` special. I
think it's worth living with that until #212 is resolved.

I'd like to merge shortly after #252 (and before #252 is released) so that user's don't
rely on #252 injecting secrets when `CustomCheck` is implemented and `DefaultCheck` is not
called.
Copy link
Member

@mjeffryes mjeffryes left a comment

Choose a reason for hiding this comment

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

I can't claim to be super familiar with this code, but it looks mostly correct to me. There are a few possible small bugs to check though.

infer/apply_secrets.go Outdated Show resolved Hide resolved
infer/apply_secrets.go Outdated Show resolved Hide resolved
infer/apply_secrets.go Show resolved Hide resolved
infer/apply_secrets.go Show resolved Hide resolved
infer/apply_secrets.go Outdated Show resolved Hide resolved
infer/configuration.go Show resolved Hide resolved
internal/introspect/introspect.go Show resolved Hide resolved
tests/config_test.go Show resolved Hide resolved
infer/apply_secrets.go Show resolved Hide resolved
tests/config_test.go Show resolved Hide resolved
iwahbe added 6 commits July 25, 2024 16:34
Part of #251

Right now, secrets are communicated in the schema and applied via SDKs. This doesn't
consistently work as expected for explicit providers.
This was added in go1.22, while we still support go1.21.
@iwahbe iwahbe force-pushed the iwahbe/inject-secrets-from-schemas branch from 3acd5ab to d3c9b59 Compare July 25, 2024 23:34
Copy link
Member

@mjeffryes mjeffryes left a comment

Choose a reason for hiding this comment

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

Looks like there's still a linter error, and maybe a test case or two to add, but I think you've covered all the potential bugs. So adding my stamp so you can land it whenever you're done.

@mjeffryes
Copy link
Member

also many thanks for all the explanations/answers to my n00b questions 🙇

infer/resource.go Outdated Show resolved Hide resolved
@iwahbe iwahbe force-pushed the iwahbe/inject-secrets-from-schemas branch from fdef94a to cd96ba2 Compare July 26, 2024 15:42
@iwahbe iwahbe force-pushed the iwahbe/inject-secrets-from-schemas branch from cd96ba2 to 4a5e543 Compare July 26, 2024 15:56
@iwahbe iwahbe merged commit 73b74eb into main Jul 26, 2024
6 checks passed
@iwahbe iwahbe deleted the iwahbe/inject-secrets-from-schemas branch July 26, 2024 16:07
iwahbe added a commit that referenced this pull request Jul 26, 2024
Following up on #252, this allows `DefaultCheck` to safely and accurately handle secrets
application. The new signature for `DefaultCheck` is easier to extend without additional
breaking changes. The downside to this design is that this makes `DefaultCheck` special. I
think it's worth living with that until #212 is resolved.

I'd like to merge shortly after #252 (and before #252 is released) so that user's don't
rely on #252 injecting secrets when `CustomCheck` is implemented and `DefaultCheck` is not
called.
iwahbe added a commit that referenced this pull request Jul 26, 2024
Following up on #252, this allows `DefaultCheck` to safely and accurately handle secrets
application. The new signature for `DefaultCheck` is easier to extend without additional
breaking changes. The downside to this design is that this makes `DefaultCheck` special. I
think it's worth living with that until #212 is resolved.

I'd like to merge shortly after #252 (and before #252 is released) so that user's don't
rely on #252 injecting secrets when `CustomCheck` is implemented and `DefaultCheck` is not
called.
iwahbe added a commit that referenced this pull request Jul 26, 2024
Following up on #252, this allows `DefaultCheck` to safely and accurately handle secrets
application. The new signature for `DefaultCheck` is easier to extend without additional
breaking changes. The downside to this design is that this makes `DefaultCheck` special. I
think it's worth living with that until #212 is resolved.

I'd like to merge shortly after #252 (and before #252 is released) so that user's don't
rely on #252 injecting secrets when `CustomCheck` is implemented and `DefaultCheck` is not
called.

Rational for the change:

Ideally, most users will not need to implement check. By design, not implementing
`CustomCheck` has the same behavior as implementing check with
`return infer.DefaultCheck(...)`. If users do implement `CustomCheck`, then we don't want
to make any assumptions about what behavior they want. This includes not applying defaults
and not injecting secrets.
iwahbe added a commit that referenced this pull request Jul 27, 2024
Following up on #252, this allows `DefaultCheck` to safely and accurately handle secrets
application. The new signature for `DefaultCheck` is easier to extend without additional
breaking changes. The downside to this design is that this makes `DefaultCheck` special. I
think it's worth living with that until #212 is resolved.

I'd like to merge shortly after #252 (and before #252 is released) so that user's don't
rely on #252 injecting secrets when `CustomCheck` is implemented and `DefaultCheck` is not
called.

Rational for the change:

Ideally, most users will not need to implement check. By design, not implementing
`CustomCheck` has the same behavior as implementing check with
`return infer.DefaultCheck(...)`. If users do implement `CustomCheck`, then we don't want
to make any assumptions about what behavior they want. This includes not applying defaults
and not injecting secrets.
iwahbe added a commit that referenced this pull request Jul 27, 2024
Following up on #252, this allows `DefaultCheck` to safely and accurately handle secrets
application. The new signature for `DefaultCheck` is easier to extend without additional
breaking changes. The downside to this design is that this makes `DefaultCheck` special. I
think it's worth living with that until #212 is resolved.

I'd like to merge shortly after #252 (and before #252 is released) so that user's don't
rely on #252 injecting secrets when `CustomCheck` is implemented and `DefaultCheck` is not
called.

Rational for the change:

Ideally, most users will not need to implement check. By design, not implementing
`CustomCheck` has the same behavior as implementing check with
`return infer.DefaultCheck(...)`. If users do implement `CustomCheck`, then we don't want
to make any assumptions about what behavior they want. This includes not applying defaults
and not injecting secrets.
@pulumi-bot
Copy link

This PR has been shipped in release v0.21.0.

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.

Ensure that provider:"secret" works as expected on the Provider resource
4 participants