From 0e37ae758ca22f38e9a3d021451e29e92cb96eb7 Mon Sep 17 00:00:00 2001 From: x539 Date: Sat, 9 Jul 2022 05:48:59 +0200 Subject: [PATCH] fix: Take app_id_client_regex from user_pool_config (#35) (#38) --- examples/complete/README.md | 1 + examples/complete/main.tf | 8 +++++++- examples/complete/outputs.tf | 1 + main.tf | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/complete/README.md b/examples/complete/README.md index 7c05222..d22b886 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -44,6 +44,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Type | |------|------| | [aws_cognito_user_pool.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_user_pool) | resource | +| [aws_cognito_user_pool_client.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_user_pool_client) | resource | | [aws_route53_record.api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | | [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource | | [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource | diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 1f7803b..8b1df4b 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -135,7 +135,8 @@ module "appsync" { authentication_type = "AMAZON_COGNITO_USER_POOLS" user_pool_config = { - user_pool_id = aws_cognito_user_pool.this.id + user_pool_id = aws_cognito_user_pool.this.id + app_id_client_regex = aws_cognito_user_pool_client.this.id } } } @@ -264,6 +265,11 @@ resource "aws_cognito_user_pool" "this" { name = "user-pool-${random_pet.this.id}" } +resource "aws_cognito_user_pool_client" "this" { + name = "user-pool-client-${random_pet.this.id}" + user_pool_id = aws_cognito_user_pool.this.id +} + #module "aws_lambda_function1" { # source = "terraform-aws-modules/cloudwatch/aws//examples/fixtures/aws_lambda_function" #} diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf index 7100f7f..1810954 100644 --- a/examples/complete/outputs.tf +++ b/examples/complete/outputs.tf @@ -39,6 +39,7 @@ output "appsync_api_key_id" { output "appsync_api_key_key" { description = "Map of API Keys" value = module.appsync.appsync_api_key_key + sensitive = true } # Datasources diff --git a/main.tf b/main.tf index 962e569..a684140 100644 --- a/main.tf +++ b/main.tf @@ -51,8 +51,8 @@ resource "aws_appsync_graphql_api" "this" { content { default_action = var.user_pool_config["default_action"] user_pool_id = var.user_pool_config["user_pool_id"] - app_id_client_regex = lookup(var.openid_connect_config, "app_id_client_regex", null) - aws_region = lookup(var.openid_connect_config, "aws_region", null) + app_id_client_regex = lookup(var.user_pool_config, "app_id_client_regex", null) + aws_region = lookup(var.user_pool_config, "aws_region", null) } }