You must be logged in to view saved presets
Sets up a Cognito User Pool with a client integrated with Pinpoint analytics for enhanced data collection.
data "aws_caller_identity" "current" {
}
data "aws_iam_policy_document" "assume_role" {
statement {
actions = ["sts:AssumeRole"]
effect = "Allow"
principals {
identifiers = ["cognito-idp.amazonaws.com"]
type = "Service"
}
}
}
data "aws_iam_policy_document" "test" {
statement {
actions = ["mobiletargeting:UpdateEndpoint", "mobiletargeting:PutEvents"]
effect = "Allow"
resources = ["arn:aws:mobiletargeting:*:${data.aws_caller_identity.current.account_id}:apps/${aws_pinpoint_app.test.application_id}*"]
}
}
resource "aws_cognito_user_pool" "test" {
name = "pool"
}
resource "aws_cognito_user_pool_client" "test" {
analytics_configuration {
application_id = aws_pinpoint_app.test.application_id
external_id = "some_id"
role_arn = aws_iam_role.test.arn
user_data_shared = true
}
name = "pool_client"
user_pool_id = aws_cognito_user_pool.test.id
}
resource "aws_iam_role" "test" {
assume_role_policy = data.aws_iam_policy_document.assume_role.json
name = "role"
}
resource "aws_iam_role_policy" "test" {
name = "role_policy"
policy = data.aws_iam_policy_document.test.json
role = aws_iam_role.test.id
}
resource "aws_pinpoint_app" "test" {
name = "pinpoint"
}