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

r/cognito_user_pool - add pre_token_generation_config to lambda_config #35236

Merged
merged 24 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
acc922c
feat: add pre_token_generation_config in Cognito User Pool
AndresMorelos Jan 11, 2024
6738848
fix: updating changelog PR number
AndresMorelos Jan 11, 2024
b011e80
fix: Add advanced security mode to user pool add-ons when pre_token_g…
AndresMorelos Jan 11, 2024
d07c802
fix: fix config function names
AndresMorelos Jan 11, 2024
30d57aa
fix: Only one configuration pre_token_generation or pre_token_generat…
AndresMorelos Jan 11, 2024
d363470
fix: Making pre_token_generation and pre_token_generation_config fiel…
AndresMorelos Jan 12, 2024
1fc804f
fix: Removing big comment and customdiff helper
AndresMorelos Jan 12, 2024
e9abb2d
Prevent read-only ActiveEncryptionCertificate property from being use…
jdoetsch-built Mar 12, 2024
85c09da
Add changelog file
jdoetsch-built Mar 12, 2024
806e528
Merge commit '85c09da5b3787ddd817a8e01ea02fc0ab83a2203' into HEAD
ewbankkit Mar 12, 2024
aa0dbff
Tweak CHANGELOG entries.
ewbankkit Mar 12, 2024
b81c930
r/aws_cognito_identity_provider: Reduce visibility.
ewbankkit Mar 12, 2024
ee58d1f
Add 'TestAccCognitoIDPIdentityProvider_saml'.
ewbankkit Mar 12, 2024
750d13b
r/aws_cognito_identity_provider: Tidy up acceptance tests.
ewbankkit Mar 12, 2024
d77f3e1
cognitoidentity: Reduce visibility.
ewbankkit Mar 13, 2024
d9cca32
'internal/service/cognitoidp/testdata' -> 'internal/service/cognitoid…
ewbankkit Mar 13, 2024
182963f
r/aws_cognito_user_pool_ui_customization: Tidy up.
ewbankkit Mar 13, 2024
d9c0323
cognitoidp: Reduce visibility.
ewbankkit Mar 13, 2024
1aefb92
r/aws_cognito_user_pool: Tidy up.
ewbankkit Mar 13, 2024
337812d
r/aws_cognito_risk_configuration: Handle 'ResourceNotFoundException' …
ewbankkit Mar 13, 2024
c734756
r/aws_cognito_user: Handle 'ResourceNotFoundException' in Delete.
ewbankkit Mar 13, 2024
bc1b9fa
Fix semgrep 'ci.semgrep.migrate.error-check-service-id'.
ewbankkit Mar 13, 2024
9a37564
Fixup example.
ewbankkit Mar 13, 2024
cb6c6f8
r/aws_cognito_user: Handle 'UserNotFoundException' in Delete.
ewbankkit Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/35236.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_cognito_user_pool: Add `pre_token_generation_config` configuration block
```
3 changes: 3 additions & 0 deletions .changelog/36311.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_cognito_identity_provider: Fix `InvalidParameterException: ActiveEncryptionCertificate is not a valid key for SAML identity provider details` errors on resource Update
```
7 changes: 6 additions & 1 deletion examples/cognito-user-pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ resource "aws_cognito_user_pool" "pool" {
post_confirmation = aws_lambda_function.main.arn
pre_authentication = aws_lambda_function.main.arn
pre_sign_up = aws_lambda_function.main.arn
pre_token_generation = aws_lambda_function.main.arn
pre_token_generation = aws_lambda_function.main.arn # Set this parameter for legacy purposes; for new instances of pre token generation triggers, set the LambdaArn of `pre_token_generation_config`
user_migration = aws_lambda_function.main.arn
verify_auth_challenge_response = aws_lambda_function.main.arn

pre_token_generation_config {
lambda_arn = aws_lambda_function.main.arn # Should be a identical to the pre_token_generation lambda ARN if used
lambda_version = "V2_0"
}
}

schema {
Expand Down
11 changes: 11 additions & 0 deletions internal/service/cognitoidentity/exports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package cognitoidentity

// Exports for use in tests only.
var (
ResourcePool = resourcePool
ResourcePoolProviderPrincipalTag = resourcePoolProviderPrincipalTag
ResourcePoolRolesAttachment = resourcePoolRolesAttachment
)
2 changes: 1 addition & 1 deletion internal/service/cognitoidentity/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

// @SDKResource("aws_cognito_identity_pool", name="Pool")
// @Tags(identifierAttribute="arn")
func ResourcePool() *schema.Resource {
func resourcePool() *schema.Resource {
return &schema.Resource{
CreateWithoutTimeout: resourcePoolCreate,
ReadWithoutTimeout: resourcePoolRead,
Expand Down
2 changes: 1 addition & 1 deletion internal/service/cognitoidentity/pool_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

// @SDKDataSource("aws_cognito_identity_pool", name="Pool")
// @Tags(identifierAttribute="arn")
func DataSourcePool() *schema.Resource {
func dataSourcePool() *schema.Resource {
return &schema.Resource{
ReadWithoutTimeout: dataSourcePoolRead,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

// @SDKResource("aws_cognito_identity_pool_provider_principal_tag")
func ResourcePoolProviderPrincipalTag() *schema.Resource {
// @SDKResource("aws_cognito_identity_pool_provider_principal_tag", name="Provider Principal Tags")
func resourcePoolProviderPrincipalTag() *schema.Resource {
return &schema.Resource{
CreateWithoutTimeout: resourcePoolProviderPrincipalTagCreate,
ReadWithoutTimeout: resourcePoolProviderPrincipalTagRead,
Expand Down
4 changes: 2 additions & 2 deletions internal/service/cognitoidentity/pool_roles_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

// @SDKResource("aws_cognito_identity_pool_roles_attachment")
func ResourcePoolRolesAttachment() *schema.Resource {
// @SDKResource("aws_cognito_identity_pool_roles_attachment", name="Pool Roles Association")
func resourcePoolRolesAttachment() *schema.Resource {
return &schema.Resource{
CreateWithoutTimeout: resourcePoolRolesAttachmentCreate,
ReadWithoutTimeout: resourcePoolRolesAttachmentRead,
Expand Down
10 changes: 6 additions & 4 deletions internal/service/cognitoidentity/service_package_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions internal/service/cognitoidp/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import (
)

const (
ResNameIdentityProvider = "Identity Provider"
ResNameResourceServer = "Resource Server"
ResNameRiskConfiguration = "Risk Configuration"
ResNameUserPoolClient = "User Pool Client"
ResNameUserPoolDomain = "User Pool Domain"
ResNameUserPool = "User Pool"
ResNameUser = "User"
)

Expand Down
20 changes: 16 additions & 4 deletions internal/service/cognitoidp/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,21 @@ package cognitoidp

// Exports for use in tests only.
var (
ResourceUserGroup = resourceUserGroup
ResourceUserPoolClient = newResourceUserPoolClient
ResourceManagedUserPoolClient = newResourceManagedUserPoolClient
ResourceIdentityProvider = resourceIdentityProvider
ResourceManagedUserPoolClient = newManagedUserPoolClientResource
ResourceResourceServer = resourceResourceServer
ResourceRiskConfiguration = resourceRiskConfiguration
ResourceUser = resourceUser
ResourceUserGroup = resourceUserGroup
ResourceUserInGroup = resourceUserInGroup
ResourceUserPool = resourceUserPool
ResourceUserPoolClient = newUserPoolClientResource
ResourceUserPoolDomain = resourceUserPoolDomain
ResourceUserPoolUICustomization = resourceUserPoolUICustomization

FindGroupByTwoPartKey = findGroupByTwoPartKey
FindGroupByTwoPartKey = findGroupByTwoPartKey
FindIdentityProviderByTwoPartKey = findIdentityProviderByTwoPartKey
FindUserByTwoPartKey = findUserByTwoPartKey
FindUserPoolByID = findUserPoolByID
FindUserPoolUICustomizationByTwoPartKey = findUserPoolUICustomizationByTwoPartKey
)
28 changes: 0 additions & 28 deletions internal/service/cognitoidp/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"errors"
"fmt"
"reflect"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
Expand All @@ -16,33 +15,6 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
)

// FindCognitoUserPoolUICustomization returns the UI Customization corresponding to the UserPoolId and ClientId.
// Returns nil if no UI Customization is found.
func FindCognitoUserPoolUICustomization(ctx context.Context, conn *cognitoidentityprovider.CognitoIdentityProvider, userPoolId, clientId string) (*cognitoidentityprovider.UICustomizationType, error) {
input := &cognitoidentityprovider.GetUICustomizationInput{
ClientId: aws.String(clientId),
UserPoolId: aws.String(userPoolId),
}

output, err := conn.GetUICustomizationWithContext(ctx, input)

if err != nil {
return nil, err
}

if output == nil || output.UICustomization == nil {
return nil, nil
}

// The GetUICustomization API operation will return an empty struct
// if nothing is present rather than nil or an error, so we equate that with nil
if reflect.DeepEqual(output.UICustomization, &cognitoidentityprovider.UICustomizationType{}) {
return nil, nil
}

return output.UICustomization, nil
}

// FindCognitoUserInGroup checks whether the specified user is present in the specified group. Returns boolean value accordingly.
func FindCognitoUserInGroup(ctx context.Context, conn *cognitoidentityprovider.CognitoIdentityProvider, groupName, userPoolId, username string) (bool, error) {
input := &cognitoidentityprovider.AdminListGroupsForUserInput{
Expand Down
Loading
Loading