Open sergei-ivanov opened 3 years ago
I realise that generate_secret
is only relevant on resource creation, and that changing it in terraform configuration should trigger a resource recreation.
However, once a resource has been created, there will be a client_secret
value there. That value will be non-empty if the secret was generated and empty if the secret was not generated. Therefore from the presence or absence of non-empty client_secret
we can deduce the value of generate_secret
flag.
So perhaps a simple fix might be to add a check after this line: https://github.com/hashicorp/terraform-provider-aws/blob/f9743a331518d27998037de918b1b769eb11a27c/aws/resource_aws_cognito_user_pool_client.go#L366 Something like this:
d.Set("generate_secret", aws.StringValue(userPoolClient.ClientSecret) != "")
Same behavior with Terraform v1.1.2 and aws provider v4.36.1
Any update on this issue? Still running into this with Terraform v1.3.6 and aws provider v4.46.0
Any update? As a temporary workaround, I use the lifecycle option "ignore_changes".
Are there any updates? This is still an issue for TF v0.13.4 and aws provider v4.0
In my case, I got around this by ignoring generate_secret
on my already existing user_pool_client.
resource "aws_cognito_user_pool_client" "pool" {
...
lifecycle {
ignore_changes = [generate_secret]
}
}
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
N/A
Panic Output
N/A
Expected Behavior
When running
terraform import
for theaws_cognito_user_pool_client
resource,generate_secret
attribute should be initialised in the state.Actual Behavior
Upon import,
generate_secret
isnull
in the state. As a result, subsequent changes to the pool trigger resource replacement:Manually editing the state and setting
generate_secret
tofalse
fixes the plan drift.Steps to Reproduce
callback_urls
.terraform plan
The plan suggests a forced replacement.