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.7k stars 9.07k forks source link

[Bug]: setting refresh_token_validity failed #34392

Open DorBenDavid opened 9 months ago

DorBenDavid commented 9 months ago

Terraform Core Version

0.0.0

AWS Provider Version

4.64.0

Affected Resource(s)

No response

Expected Behavior

in terraform resource 'aws_cognito_user_pool_client' trying to set the attribute for 'refresh_token_validity' i receive error on apply no matter what i tried

Error: Invalid Attribute Value
│ in resource "aws_cognito_user_pool_client" "client":
│  201:   refresh_token_validity  = 30  # Set the refresh token validity in days
│
│ Attribute refresh_token_validity must have a duration between 1h0m0s and 87600h0m0s, got: 0s`
│ Error: Incorrect attribute value type
│ in resource "aws_cognito_user_pool_client" "client":
│  201:   refresh_token_validity = "720h0m0s"
│
│ Inappropriate value for attribute "refresh_token_validity": a number is required.`
│ Error: Missing newline after argument
│ in resource "aws_cognito_user_pool_client" "client":
│  201:   refresh_token_validity = 720h0m0s
│ 
│ An argument definition must end with a newline.`

how can i set this

Actual Behavior

succeed in setting the value, setting the aws cognito refresh token to the specified value

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

None

Steps to Reproduce

resource "aws_cognito_user_pool" "test" {
  name = "pool"
}

resource "aws_cognito_user_pool_client" "client" {
  name                = "test"
  refresh_token_validity = 87600
user_pool_id                  = aws_cognito_user_pool.test.id
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 9 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 9 months ago

Hey @DorBenDavid 👋 Thank you for taking the time to raise this! Are you able to test this on a more recent version of the AWS provider to see if the issue persists?

It does seem like this could potentially be related to #30662, based on some of the comments on that PR. With that in mind, it might be worth testing to see if adding the token_validity_units block to your configuration helps at all.

DorBenDavid commented 9 months ago

Hello, Thanks for the reply also with the token_validity_units block this cause the same error. but i noticed that when i change the token_validity_units .refresh_token to "hours" this manage to work while the default is "days"