I’m trying to create a aws_cognito_identity_provider
resource, with dynamic block defines of the provider_details
attribute depending on which Cognito Identity provider used.
resource "aws_cognito_identity_provider" "provider" {
count = length(var.pool_provider.type) > 0 ? 1 : 0
user_pool_id = aws_cognito_user_pool.pool.id
provider_name = var.pool_provider.type
provider_type = var.pool_provider.type
dynamic "provider_details" {
for_each = (var.pool_provider.type == "Google" || var.pool_provider.type == "LoginWithAmazon") ? [1] : []
content {
authorize_scopes = "email"
client_id = "your client_id"
client_secret = "your client_secret"
}
}
But that just gives me: Blocks of type “provider_details” are not expected here.
If I instead use
dynamic "provider_details" = {
[...]
}
I get The equals sign “=” indicates an argument definition, and must not be used when defining a block.
Anyone have any ideas?