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

[Bug]: unable to apply with aws_cognito_user_pool_client #30257

Closed
borfig opened this issue Mar 26, 2023 · 5 comments · Fixed by #30459
Closed

[Bug]: unable to apply with aws_cognito_user_pool_client #30257

borfig opened this issue Mar 26, 2023 · 5 comments · Fixed by #30459
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. terraform-plugin-migration Issues that are related to the providers migration to Terraform Plugin Framework.

Comments

@borfig
Copy link

borfig commented Mar 26, 2023

Terraform Core Version

1.3.0

AWS Provider Version

4.60.0

Affected Resource(s)

  • aws_cognito_user_pool_client

Expected Behavior

The terraform apply should succeed with no changes.

Actual Behavior

The terraform apply fails with an error.

Relevant Error/Panic Output Snippet

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ aws_cognito_user_pool_client.this, provider
│ "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected
│ new value: .allowed_oauth_scopes: was cty.SetValEmpty(cty.String), but now
│ null.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Terraform Configuration Files

resource "aws_cognito_user_pool_client" "this" {
  name            = "<some-name>"
  user_pool_id    = "<some-user-pool-id>"

  allowed_oauth_flows                  = []
  allowed_oauth_flows_user_pool_client = false
  allowed_oauth_scopes                 = []
  callback_urls                        = []
  logout_urls                          = []
  explicit_auth_flows                  = ["ALLOW_ADMIN_USER_PASSWORD_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"]
  read_attributes                      = []
  supported_identity_providers         = ["COGNITO"]
  prevent_user_existence_errors        = "ENABLED"
}

Steps to Reproduce

  1. Deploy a user pool client with an older version of the provider (version 4.59.0 will do)
  2. Update the terraform lock to install AWS provider version 4.60.0
  3. run terraform apply without changing anything in the resource

Debug Output

No response

Panic Output

No response

Important Factoids

The issue does not reproduce in version 4.59.0

References

No response

Would you like to implement a fix?

None

@borfig borfig added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Mar 26, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/cognitoidp Issues and PRs that pertain to the cognitoidp service. label Mar 26, 2023
@borfig borfig changed the title [Bug]: [Bug]: unable to apply with aws_cognito_user_pool_client Mar 26, 2023
@ewbankkit
Copy link
Contributor

ewbankkit commented Mar 27, 2023

Relates #30140.

func newUserPoolClientData(ctx context.Context, plan resourceUserPoolClientData, in *cognitoidentityprovider.UserPoolClientType, diags *diag.Diagnostics) resourceUserPoolClientData {
return resourceUserPoolClientData{
AccessTokenValidity: flex.Int64ToFrameworkLegacy(ctx, in.AccessTokenValidity),
AllowedOauthFlows: flex.FlattenFrameworkStringSet(ctx, in.AllowedOAuthFlows),
AllowedOauthFlowsUserPoolClient: flex.BoolToFramework(ctx, in.AllowedOAuthFlowsUserPoolClient),
AllowedOauthScopes: flex.FlattenFrameworkStringSet(ctx, in.AllowedOAuthScopes),
AnalyticsConfiguration: flattenAnaylticsConfiguration(ctx, in.AnalyticsConfiguration, diags),
AuthSessionValidity: flex.Int64ToFramework(ctx, in.AuthSessionValidity),
CallbackUrls: flex.FlattenFrameworkStringSet(ctx, in.CallbackURLs),
ClientSecret: flex.StringToFrameworkLegacy(ctx, in.ClientSecret),
DefaultRedirectUri: flex.StringToFrameworkLegacy(ctx, in.DefaultRedirectURI),
EnablePropagateAdditionalUserContextData: flex.BoolToFramework(ctx, in.EnablePropagateAdditionalUserContextData),
EnableTokenRevocation: flex.BoolToFramework(ctx, in.EnableTokenRevocation),
ExplicitAuthFlows: flex.FlattenFrameworkStringSet(ctx, in.ExplicitAuthFlows),
ID: flex.StringToFramework(ctx, in.ClientId),
IdTokenValidity: flex.Int64ToFrameworkLegacy(ctx, in.IdTokenValidity),
GenerateSecret: plan.GenerateSecret,
LogoutUrls: flex.FlattenFrameworkStringSet(ctx, in.LogoutURLs),
Name: flex.StringToFramework(ctx, in.ClientName),
PreventUserExistenceErrors: flex.StringToFrameworkLegacy(ctx, in.PreventUserExistenceErrors),
ReadAttributes: flex.FlattenFrameworkStringSet(ctx, in.ReadAttributes),
RefreshTokenValidity: flex.Int64ToFramework(ctx, in.RefreshTokenValidity),
SupportedIdentityProviders: flex.FlattenFrameworkStringSet(ctx, in.SupportedIdentityProviders),
TokenValidityUnits: flattenTokenValidityUnits(ctx, in.TokenValidityUnits),
UserPoolID: flex.StringToFramework(ctx, in.UserPoolId),
WriteAttributes: flex.FlattenFrameworkStringSet(ctx, in.WriteAttributes),
}
}

I think that a FlattenFrameworkStringSetLegacy function that converts nil to and empty set is required here.
Relates hashicorp/terraform-plugin-framework#510.
Relates hashicorp/terraform-plugin-framework#70.

@ewbankkit ewbankkit added regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. bug Addresses a defect in current functionality. and removed bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Mar 27, 2023
@gdavison gdavison self-assigned this Mar 29, 2023
@joshlang
Copy link

joshlang commented Apr 1, 2023

Similar bug:

│ Error: Provider produced inconsistent result after apply
--
348 | │
349 | │ When applying changes to aws_cognito_user_pool_client.client, provider
350 | │ "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected
351 | │ new value: .token_validity_units: block count changed from 0 to 1.
352 | │
353 | │ This is a bug in the provider, which should be reported in the provider's
354 | │ own issue tracker.

@gdavison
Copy link
Contributor

Closed by #30459

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2023
@jar-b jar-b added the terraform-plugin-migration Issues that are related to the providers migration to Terraform Plugin Framework. label Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. terraform-plugin-migration Issues that are related to the providers migration to Terraform Plugin Framework.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants