@webiny/pulumi-aws 5.42.1-beta.0 → 5.42.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,8 +31,16 @@ const configureAdminCognitoFederation = (app, config) => {
31
31
  const idpConfigs = [];
32
32
  for (const idp of config.identityProviders) {
33
33
  const config = (0, _getIdpConfig.getIdpConfig)(idp.type, userPool.output.id, idp);
34
+
35
+ // The idea to lowercase the provider name emerged while working on backwards compatibility issue.
36
+ // Basically, in cases where a user used the OIDC provider and did not specify a name, instead of
37
+ // using `OIDC` as the name, we wanted to ensure `oidc` is used. But, what I soon realized is that
38
+ // by simply lowercasing the name, we can avoid the need to check for the provider type and name.
39
+ // And although this will now happen for all providers, it's not a problem since Pulumi requires
40
+ // names to be all lowercase anyway.
41
+ const name = config.providerName.toString().toLowerCase();
34
42
  app.addResource(aws.cognito.IdentityProvider, {
35
- name: config.providerName.toString(),
43
+ name,
36
44
  config
37
45
  });
38
46
  idpConfigs.push(config);
@@ -1 +1 @@
1
- {"version":3,"names":["aws","_interopRequireWildcard","require","pulumi","_getIdpConfig","isString","value","configureAdminCognitoFederation","app","config","region","String","process","env","AWS_REGION","userPool","resources","appClient","userPoolClient","userPoolDomain","addResource","cognito","UserPoolDomain","name","domain","certificateArn","undefined","userPoolId","output","id","addOutput","interpolate","idpConfigs","idp","identityProviders","getIdpConfig","type","IdentityProvider","providerName","toString","push","supportedIdentityProviders","map","providerType","allowedOauthScopes","allowedOauthFlows","allowedOauthFlowsUserPoolClient","callbackUrls","logoutUrls","exports"],"sources":["configure.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { UserPoolDomainArgs } from \"@pulumi/aws/cognito/userPoolDomain\";\nimport { IdentityProviderArgs } from \"@pulumi/aws/cognito\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { PulumiApp, PulumiAppResource, PulumiAppResourceConstructor } from \"@webiny/pulumi\";\nimport { getIdpConfig } from \"./getIdpConfig\";\n\nexport type IdentityAttributeMapping = {\n \"custom:id\": string;\n username: string;\n email: string;\n family_name: string;\n given_name: string;\n [key: string]: string;\n};\n\nexport interface CognitoIdentityProvidersConfig {\n domain:\n | string\n | {\n name: UserPoolDomainArgs[\"domain\"];\n certificateArn?: UserPoolDomainArgs[\"certificateArn\"];\n };\n identityProviders: CognitoIdentityProviderConfig[];\n callbackUrls: string[];\n logoutUrls?: string[];\n}\n\nexport interface CognitoIdentityProviderConfig {\n name?: string;\n type: \"google\" | \"facebook\" | \"amazon\" | \"apple\" | \"oidc\";\n providerDetails: IdentityProviderArgs[\"providerDetails\"];\n idpIdentifiers?: IdentityProviderArgs[\"idpIdentifiers\"];\n attributeMapping?: IdentityAttributeMapping;\n}\n\nconst isString = (value?: any): value is string => {\n return typeof value === \"string\";\n};\n\nexport const configureAdminCognitoFederation = (\n app: PulumiApp,\n config: CognitoIdentityProvidersConfig\n) => {\n const region = String(process.env.AWS_REGION);\n\n const userPool = app.resources.userPool as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPool>\n >;\n\n const appClient = app.resources.userPoolClient as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPoolClient>\n >;\n\n /**\n * We need to create a user pool domain, which is used to interact with the federated identity providers.\n */\n const userPoolDomain = app.addResource(aws.cognito.UserPoolDomain, {\n name: \"cognitoUserPoolDomain\",\n config: {\n domain: isString(config.domain) ? config.domain : config.domain.name,\n certificateArn: isString(config.domain) ? undefined : config.domain.certificateArn,\n userPoolId: userPool.output.id\n }\n });\n\n app.addOutput(\n \"cognitoUserPoolDomain\",\n pulumi.interpolate`${userPoolDomain.output.domain}.auth.${region}.amazoncognito.com`\n );\n\n const idpConfigs: aws.cognito.IdentityProviderArgs[] = [];\n\n for (const idp of config.identityProviders) {\n const config = getIdpConfig(idp.type, userPool.output.id, idp);\n\n app.addResource(aws.cognito.IdentityProvider, {\n name: config.providerName.toString(),\n config\n });\n\n idpConfigs.push(config);\n }\n\n appClient.config.supportedIdentityProviders([\n \"COGNITO\",\n ...idpConfigs.map(config => {\n // For built-in identity providers, we use the type as the name. Only for OIDC,\n // we allow the user to provide a custom name, and we only use the type as a fallback.\n if (config.providerType === \"OIDC\") {\n return config.providerName;\n }\n return config.providerType;\n })\n ]);\n\n appClient.config.allowedOauthScopes([\"profile\", \"email\", \"openid\"]);\n appClient.config.allowedOauthFlows([\"implicit\", \"code\"]);\n appClient.config.allowedOauthFlowsUserPoolClient(true);\n appClient.config.callbackUrls(config.callbackUrls);\n appClient.config.logoutUrls(config.logoutUrls ?? config.callbackUrls);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AA+BA,MAAMG,QAAQ,GAAIC,KAAW,IAAsB;EAC/C,OAAO,OAAOA,KAAK,KAAK,QAAQ;AACpC,CAAC;AAEM,MAAMC,+BAA+B,GAAGA,CAC3CC,GAAc,EACdC,MAAsC,KACrC;EACD,MAAMC,MAAM,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC;EAE7C,MAAMC,QAAQ,GAAGP,GAAG,CAACQ,SAAS,CAACD,QAE9B;EAED,MAAME,SAAS,GAAGT,GAAG,CAACQ,SAAS,CAACE,cAE/B;;EAED;AACJ;AACA;EACI,MAAMC,cAAc,GAAGX,GAAG,CAACY,WAAW,CAACpB,GAAG,CAACqB,OAAO,CAACC,cAAc,EAAE;IAC/DC,IAAI,EAAE,uBAAuB;IAC7Bd,MAAM,EAAE;MACJe,MAAM,EAAEnB,QAAQ,CAACI,MAAM,CAACe,MAAM,CAAC,GAAGf,MAAM,CAACe,MAAM,GAAGf,MAAM,CAACe,MAAM,CAACD,IAAI;MACpEE,cAAc,EAAEpB,QAAQ,CAACI,MAAM,CAACe,MAAM,CAAC,GAAGE,SAAS,GAAGjB,MAAM,C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ACtC,MAAM,CAACsC,YAAY,CAAC;EAClD9B,SAAS,CAACR,MAAM,CAACuC,UAAU,CAACvC,MAAM,CAACuC,UAAU,IAAIvC,MAAM,CAACsC,YAAY,CAAC;AACzE,CAAC;AAACE,OAAA,CAAA1C,+BAAA,GAAAA,+BAAA","ignoreList":[]}
1
+ {"version":3,"names":["aws","_interopRequireWildcard","require","pulumi","_getIdpConfig","isString","value","configureAdminCognitoFederation","app","config","region","String","process","env","AWS_REGION","userPool","resources","appClient","userPoolClient","userPoolDomain","addResource","cognito","UserPoolDomain","name","domain","certificateArn","undefined","userPoolId","output","id","addOutput","interpolate","idpConfigs","idp","identityProviders","getIdpConfig","type","providerName","toString","toLowerCase","IdentityProvider","push","supportedIdentityProviders","map","providerType","allowedOauthScopes","allowedOauthFlows","allowedOauthFlowsUserPoolClient","callbackUrls","logoutUrls","exports"],"sources":["configure.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { UserPoolDomainArgs } from \"@pulumi/aws/cognito/userPoolDomain\";\nimport { IdentityProviderArgs } from \"@pulumi/aws/cognito\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { PulumiApp, PulumiAppResource, PulumiAppResourceConstructor } from \"@webiny/pulumi\";\nimport { getIdpConfig } from \"./getIdpConfig\";\n\nexport type IdentityAttributeMapping = {\n \"custom:id\": string;\n username: string;\n email: string;\n family_name: string;\n given_name: string;\n [key: string]: string;\n};\n\nexport interface CognitoIdentityProvidersConfig {\n domain:\n | string\n | {\n name: UserPoolDomainArgs[\"domain\"];\n certificateArn?: UserPoolDomainArgs[\"certificateArn\"];\n };\n identityProviders: CognitoIdentityProviderConfig[];\n callbackUrls: string[];\n logoutUrls?: string[];\n}\n\nexport interface CognitoIdentityProviderConfig {\n name?: string;\n type: \"google\" | \"facebook\" | \"amazon\" | \"apple\" | \"oidc\";\n providerDetails: IdentityProviderArgs[\"providerDetails\"];\n idpIdentifiers?: IdentityProviderArgs[\"idpIdentifiers\"];\n attributeMapping?: IdentityAttributeMapping;\n}\n\nconst isString = (value?: any): value is string => {\n return typeof value === \"string\";\n};\n\nexport const configureAdminCognitoFederation = (\n app: PulumiApp,\n config: CognitoIdentityProvidersConfig\n) => {\n const region = String(process.env.AWS_REGION);\n\n const userPool = app.resources.userPool as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPool>\n >;\n\n const appClient = app.resources.userPoolClient as PulumiAppResource<\n PulumiAppResourceConstructor<aws.cognito.UserPoolClient>\n >;\n\n /**\n * We need to create a user pool domain, which is used to interact with the federated identity providers.\n */\n const userPoolDomain = app.addResource(aws.cognito.UserPoolDomain, {\n name: \"cognitoUserPoolDomain\",\n config: {\n domain: isString(config.domain) ? config.domain : config.domain.name,\n certificateArn: isString(config.domain) ? undefined : config.domain.certificateArn,\n userPoolId: userPool.output.id\n }\n });\n\n app.addOutput(\n \"cognitoUserPoolDomain\",\n pulumi.interpolate`${userPoolDomain.output.domain}.auth.${region}.amazoncognito.com`\n );\n\n const idpConfigs: aws.cognito.IdentityProviderArgs[] = [];\n\n for (const idp of config.identityProviders) {\n const config = getIdpConfig(idp.type, userPool.output.id, idp);\n\n // The idea to lowercase the provider name emerged while working on backwards compatibility issue.\n // Basically, in cases where a user used the OIDC provider and did not specify a name, instead of\n // using `OIDC` as the name, we wanted to ensure `oidc` is used. But, what I soon realized is that\n // by simply lowercasing the name, we can avoid the need to check for the provider type and name.\n // And although this will now happen for all providers, it's not a problem since Pulumi requires\n // names to be all lowercase anyway.\n const name = config.providerName.toString().toLowerCase();\n\n app.addResource(aws.cognito.IdentityProvider, { name, config });\n\n idpConfigs.push(config);\n }\n\n appClient.config.supportedIdentityProviders([\n \"COGNITO\",\n ...idpConfigs.map(config => {\n // For built-in identity providers, we use the type as the name. Only for OIDC,\n // we allow the user to provide a custom name, and we only use the type as a fallback.\n if (config.providerType === \"OIDC\") {\n return config.providerName;\n }\n return config.providerType;\n })\n ]);\n\n appClient.config.allowedOauthScopes([\"profile\", \"email\", \"openid\"]);\n appClient.config.allowedOauthFlows([\"implicit\", \"code\"]);\n appClient.config.allowedOauthFlowsUserPoolClient(true);\n appClient.config.callbackUrls(config.callbackUrls);\n appClient.config.logoutUrls(config.logoutUrls ?? config.callbackUrls);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AA+BA,MAAMG,QAAQ,GAAIC,KAAW,IAAsB;EAC/C,OAAO,OAAOA,KAAK,KAAK,QAAQ;AACpC,CAAC;AAEM,MAAMC,+BAA+B,GAAGA,CAC3CC,GAAc,EACdC,MAAsC,KACrC;EACD,MAAMC,MAAM,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC;EAE7C,MAAMC,QAAQ,GAAGP,GAAG,CAACQ,SAAS,CAACD,QAE9B;EAED,MAAME,SAAS,GAAGT,GAAG,CAACQ,SAAS,CAACE,cAE/B;;EAED;AACJ;AACA;EACI,MAAMC,cAAc,GAAGX,GAAG,CAACY,WAAW,CAACpB,GAAG,CAACqB,OAAO,CAACC,cAAc,EAAE;IAC/DC,IAAI,EAAE,uBAAuB;IAC7Bd,MAAM,EAAE;MACJe,MAAM,EAAEnB,QAAQ,CAACI,MAAM,CAACe,MAAM,CAAC,GAAGf,MAAM,CAACe,MAAM,GAAGf,MAAM,CAACe,MAAM,CAACD,IAAI;MACpEE,cAAc,EAAEpB,QAAQ,CAACI,MAAM,CAACe,MAAM,CAAC,GAAGE,SAAS,GAAGjB,MAAM,CAACe,MAAM,CAACC,cAAc;MAClFE,UAAU,EAAEZ,QAAQ,CAACa,MAAM,CAACC;IAChC;EACJ,CAAC,CAAC;EAEFrB,GAAG,CAACsB,SAAS,CACT,uBAAuB,EACvB3B,MAAM,CAAC4B,WAAW,GAAGZ,cAAc,CAACS,MAAM,CAACJ,MAAM,SAASd,MAAM,oBACpE,CAAC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AA3C,+BAAA,GAAAA,+BAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/pulumi-aws",
3
- "version": "5.42.1-beta.0",
3
+ "version": "5.42.1-beta.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/webiny/webiny-js.git"
@@ -16,19 +16,19 @@
16
16
  "@pulumi/aws": "^6.66.2",
17
17
  "@pulumi/pulumi": "^3.144.1",
18
18
  "@pulumi/random": "4.16.8",
19
- "@webiny/aws-sdk": "5.42.1-beta.0",
20
- "@webiny/cli-plugin-deploy-pulumi": "5.42.1-beta.0",
21
- "@webiny/pulumi": "5.42.1-beta.0",
22
- "@webiny/wcp": "5.42.1-beta.0",
19
+ "@webiny/aws-sdk": "5.42.1-beta.2",
20
+ "@webiny/cli-plugin-deploy-pulumi": "5.42.1-beta.2",
21
+ "@webiny/pulumi": "5.42.1-beta.2",
22
+ "@webiny/wcp": "5.42.1-beta.2",
23
23
  "form-data": "4.0.0",
24
24
  "node-fetch": "2.6.7"
25
25
  },
26
26
  "devDependencies": {
27
- "@webiny/api-page-builder": "5.42.1-beta.0",
28
- "@webiny/aws-layers": "5.42.1-beta.0",
29
- "@webiny/cli": "5.42.1-beta.0",
30
- "@webiny/feature-flags": "5.42.1-beta.0",
31
- "@webiny/project-utils": "5.42.1-beta.0",
27
+ "@webiny/api-page-builder": "5.42.1-beta.2",
28
+ "@webiny/aws-layers": "5.42.1-beta.2",
29
+ "@webiny/cli": "5.42.1-beta.2",
30
+ "@webiny/feature-flags": "5.42.1-beta.2",
31
+ "@webiny/project-utils": "5.42.1-beta.2",
32
32
  "chalk": "4.1.2",
33
33
  "lodash": "4.17.21",
34
34
  "mime": "3.0.0",
@@ -52,5 +52,5 @@
52
52
  ]
53
53
  }
54
54
  },
55
- "gitHead": "16fb9009f44f242bbc8ba0e02c1d49b1f7ab935b"
55
+ "gitHead": "86931bade22e9407f297bb69e3a898e2b7e2450a"
56
56
  }