-
Notifications
You must be signed in to change notification settings - Fork 4k
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
IAM: Ability to add a clientId to an existing OpenIdConnectProvider #32421
Comments
I am not sure if adding an |
Agreed, a setter would allow to add, remove or update the list of client IDs with just a single method. It also looks like the custom resource already handles aws-cdk/packages/@aws-cdk/custom-resource-handlers/lib/aws-iam/oidc-handler/index.ts Lines 60 to 79 in d1bd145
|
if we went with a setter method, we would also need a read property to get the existing list of ClientIds (so that we can add one more to it) |
What I had in mind would overwrite the existing values, either constructed or imported: const provider = new OpenIdConnectProvider(stack, 'MyProvider', {
url: 'https://my-url',
});
provider.clientIds = ['client1'];
// ...
const importedProvider = OpenIdConnectProvider.fromOpenIdConnectProviderArn(stack, 'provider', provider.openIdConnectProviderArn);
importedProvider.clientIds = ['client1', 'client2']; This would allow both adding to the list of clients but also to remove previous values |
This would unfortunately not work for separate environment pipelines which share the same OIDCProvider and just add their clientId to the existing provisioned one. They wont necesarily have knowledge of the other clientIds, so I was after an 'add' method rather than replace. |
Sending a list of client IDs to add to the custom resource would clash with its existing For your specific use-case, I would say a custom resource of your own is probably the way to go, see the CDK docs and the existing OidcProvider handler |
I think extending method support for OpenIdConnectProvider.fromOpenIdConnectProviderArn is more preferrable to workaround suggestion |
Describe the feature
When using the OpenIdConnectProvider it would be great to be able to add ClientIds to an existing provisioned one.
The only supported methods are:
applyRemovalPolicy(policy)
toString()
static fromOpenIdConnectProviderArn(scope, id, openIdConnectProviderArn)
ref: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.OpenIdConnectProvider.html
Use Case
When you use the OpenIdConnectProvider.fromOpenIdConnectProviderArn to reference an existing one, it would be really useful to be able to add additional clientIds to support more than one client using the same OIDCProvider.
We are limited in that you can only create one OIDC Providers with the same location/url per account so we end up sharing the same OIDC Provider.
Each environment would then want to add their own ClientId to the created OIDCProvider
Proposed Solution
Other Information
It would be good to have the clientIds as a SET so that when a clientId is added (and already there), its not duplicated in a list or breaks the deployment because already there.
Acknowledgements
CDK version used
2.133.0
Environment details (OS name and version, etc.)
macOS Sonoma. Version: 14.5
The text was updated successfully, but these errors were encountered: