Skip to content

Commit

Permalink
Fix #2868: permanent diff on Congnito UserPool (#3246)
Browse files Browse the repository at this point in the history
The actual fix is in the bridge but adding a test case here as the issue
is highly upvoted.

Fixes #2868
  • Loading branch information
t0yv0 committed Jan 23, 2024
1 parent 2e71692 commit 8b507b2
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/examples_nodejs_test.go
Expand Up @@ -500,6 +500,22 @@ func TestRegress2818(t *testing.T) {
integration.ProgramTest(t, &test)
}

// Checks aws.cognito.UserPool that had constant Diff issues.
//
// See https://github.com/pulumi/pulumi-aws/issues/2868
func TestRegress2868(t *testing.T) {
test := getJSBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "regress-2868"),

// TODO[pulumi/pulumi-aws#3303] does not refresh cleanly
SkipRefresh: true,
})
// Disable envRegion mangling
test.Config = nil
integration.ProgramTest(t, &test)
}

func getJSBaseOptions(t *testing.T) integration.ProgramTestOptions {
envRegion := getEnvRegion(t)
baseJS := integration.ProgramTestOptions{
Expand Down
3 changes: 3 additions & 0 deletions examples/regress-2868/Pulumi.yaml
@@ -0,0 +1,3 @@
name: regress-2868
runtime: nodejs
description: Regress pulumi/pulumi-aws#2868
112 changes: 112 additions & 0 deletions examples/regress-2868/index.ts
@@ -0,0 +1,112 @@
// Copyright 2016-2024, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

export const AppUsersPool = new aws.cognito.UserPool("test-user-pool", {
accountRecoverySetting: {
recoveryMechanisms: [{
name: "verified_email",
priority: 1,
}],
},
autoVerifiedAttributes: ["email"],
mfaConfiguration: "OPTIONAL",
name: "test-user-pool",
passwordPolicy: {
minimumLength: 8,
requireLowercase: true,
requireNumbers: true,
requireSymbols: true,
requireUppercase: true,
temporaryPasswordValidityDays: 300,
},
schemas: [{
attributeDataType: "String",
mutable: true,
name: "name",
required: true,
stringAttributeConstraints: {
maxLength: "2048",
minLength: "0",
},
}],
softwareTokenMfaConfiguration: {
enabled: true,
},
usernameAttributes: ["email"],
usernameConfiguration: {
caseSensitive: false,
},
});

export const testuserpoolclient = new aws.cognito.UserPoolClient("test-userpool-client", {
analyticsConfiguration: undefined,
accessTokenValidity: 60,
enableTokenRevocation: true,
explicitAuthFlows: [
"ALLOW_USER_SRP_AUTH",
"ALLOW_USER_PASSWORD_AUTH",
"ALLOW_REFRESH_TOKEN_AUTH",
],
idTokenValidity: 60,
name: "test-userpool-client",
preventUserExistenceErrors: "ENABLED",
readAttributes: [
"given_name",
"email_verified",
"zoneinfo",
"website",
"preferred_username",
"name",
"locale",
"phone_number",
"family_name",
"birthdate",
"middle_name",
"phone_number_verified",
"profile",
"picture",
"address",
"gender",
"updated_at",
"nickname",
"email",
],
tokenValidityUnits: {
accessToken: "minutes",
idToken: "minutes",
},
userPoolId: AppUsersPool.id,
writeAttributes: [
"given_name",
"zoneinfo",
"website",
"preferred_username",
"name",
"locale",
"phone_number",
"family_name",
"birthdate",
"middle_name",
"profile",
"picture",
"address",
"gender",
"updated_at",
"nickname",
"email",
],
});
16 changes: 16 additions & 0 deletions examples/regress-2868/package.json
@@ -0,0 +1,16 @@
{
"name": "regress-2868",
"version": "0.0.1",
"license": "Apache-2.0",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@pulumi/pulumi": "^3.0.0",
"@pulumi/aws": "^6.0.0"
},
"devDependencies": {
"@types/aws-sdk": "^2.7.0",
"@types/node": "^8.0.0"
}
}
18 changes: 18 additions & 0 deletions examples/regress-2868/tsconfig.json
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.ts"
]
}

0 comments on commit 8b507b2

Please sign in to comment.