-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(iam): introduce OidcProviderNative
construct utilizing the native CloudFormation resource
#28634
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
feat(iam): introduce OidcProviderNative
construct utilizing the native CloudFormation resource
#28634
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
3036ef0
to
02274f7
Compare
The integration test is failing with the following error now
|
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Clarification Request What do you think of renaming I chose
I suggest the following name changes:
and filename change to
|
f9af6d6
to
35e95ea
Compare
35e95ea
to
a4a4a18
Compare
a4a4a18
to
8f7bc78
Compare
8f7bc78
to
211248a
Compare
const resource = new CfnOIDCProvider(this, 'Resource', { | ||
url: props.url, | ||
clientIdList: props.clientIds, | ||
thumbprintList: props.thumbprints, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation for the original OpenIdConnectProvider
passed in a CodeHash
from the provider so that CFN invokes the UPDATE handler when there are code change but the properties of the resource haven't changed.
Is this problem is fixed by using CfnOIDCProvider
?
For more context: https://github.com/aws/aws-cdk/pull/22802/files#r1018838729
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the comment. I shall look into this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @WarFox, I agree that using the name OidcProvider
makes sense because it better aligns with the AWS::IAM::OIDCProvider
that is being used but I feel like it may create too much confusion with the old resource, at least not without a lot more documentation.
After discussing with the team I believe the best option here is to use a feature flag and add changes to the existing OpenIdConnectProvider
as suggested here: #16014 (comment) with the following caveats:
- The feature flag should toggle between the two constructs,
OpenIdConnectProvider
, andOpenIdConnectProvider2
in the constructor ofOpenidConnectProvider
. - Rename
OpenIdConnectProvider2
toOpenIdConnectProviderNative
. But don't export it, only allow it to be used viaOpenIdConnectProvider
+ feature flag
thanks for pointing out to #16014 (comment) @paulhcsun. I shall look into how a feature flag is helpful for this, it is interesting. What do you think of naming it Just to confirm, is the consensus in your team NOT to deprecate |
Hey @WarFox, While I agree that it would be good to have name parity with My opinion is to go with As for deprecation, we would NOT deprecate |
* Obtain the thumbprint of the root certificate authority from the provider's | ||
* server as described in https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html | ||
*/ | ||
readonly thumbprints: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this property should be required. From the CFN docs it seems like it's optional and that there is a default certificate used if none is provided:
This property is optional. If it is not included, IAM will retrieve and use the top intermediate certificate authority (CA) thumbprint of the OpenID Connect identity provider server certificate.
I've checked with the service team and they said that if customer does not provide thumbprint, IAM will query Discovery Service to see if the Url provided is a valid Url, and based on the response IAM will either reject or accept the Url that customer provided.
I think we should make this optional and document this behaviour in the docstring and follow the service team's behaviour where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have made it optional
thanks for pushing this and updating the snapshots @paulhcsun It wasn't working for me, probably because of my broken local setup |
All good! Thanks for adding the integration test assertions :) I totally missed it before when I was just checking the commit messages. Once the build passes I'll be happy to approve this and get this finally merged in. Thank you so much for your patience and work put into this contribution! As a note for any local build failures or general issues with unknown causes, I usually just run |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
IAM is stable in CDK, so we should not introduce breaking changes. This PR introduces a new version of OIDC provider without introducing breaking changes.
Older
iam.OpenIdConnectProvider
, which uses custom resources with lambda, is marked as deprecated.The newly introduced
OidcProviderNative
uses the native CloudFormation resourceAWS::IAM::OIDCProvider
ThumbprintList
ThumbprintList
must not be empty when usingAWS::IAM::OIDCProvider
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-oidcprovider.html
https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateOpenIDConnectProvider.html
Closes #21197
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license