hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

[Bug]: aws_cognito_user_pool_client : Terraform wants to update my token_validity_units parameters even if the parameters are null #35858

Open thibops opened 4 months ago

thibops commented 4 months ago

Terraform Core Version

1.5.5

AWS Provider Version

5.37.0

Affected Resource(s)

aws_cognito_user_pool_client

Expected Behavior

No change in the infrastructure

Actual Behavior

aws_cognito_user_pool_client.multitenancy will be updated in-place
  ~ resource "aws_cognito_user_pool_client" "default-multitenancy" {
        id                                            = "aaa"
        name                                          = "default"
        # (17 unchanged attributes hidden)

      ~ token_validity_units {
          + access_token  = "hours"
          + id_token      = "hours"
            # (1 unchanged attribute hidden)
        }
    }

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_cognito_user_pool_client" "multitenancy" {
  name                                 = "default"
  user_pool_id                         = aws_cognito_user_pool.pool.id
  generate_secret                      = false
  allowed_oauth_flows_user_pool_client = false
  explicit_auth_flows                  = ["AA"]
  token_validity_units {
    refresh_token = "days"
  }
  refresh_token_validity               = 950
}

Steps to Reproduce

terraform plan

Debug Output

terraform import <my actual aws_cognito_user_pool_client ressource>
terraform state show <my actual aws_cognito_user_pool_client ressource>
resource "aws_cognito_user_pool_client" "test" {
....
token_validity_units {
        refresh_token = "days"
    }
}

Panic Output

No response

Important Factoids

These parameters should be not added in the state (optional): access_token = "hours"

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 4 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue