From fd435ca735c41674e0457d44ffc68ab8353b217f Mon Sep 17 00:00:00 2001 From: Bruno da Silva Date: Tue, 4 Aug 2020 18:24:10 +0100 Subject: [PATCH] Transformed cognito_options inner block into a dynamic block to avoid permission problems in AWS China (#63) Co-authored-by: Bruno Silva --- README.md | 34 ++++++++++++++++++---------------- main.tf | 13 ++++++++----- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 087a475..5cc483d 100644 --- a/README.md +++ b/README.md @@ -312,22 +312,24 @@ Copyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright) See [LICENSE](LICENSE) for full details. - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. +```text +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +``` diff --git a/main.tf b/main.tf index 97344ad..479144a 100644 --- a/main.tf +++ b/main.tf @@ -176,11 +176,14 @@ resource "aws_elasticsearch_domain" "default" { automated_snapshot_start_hour = var.automated_snapshot_start_hour } - cognito_options { - enabled = var.cognito_authentication_enabled - user_pool_id = var.cognito_user_pool_id - identity_pool_id = var.cognito_identity_pool_id - role_arn = var.cognito_iam_role_arn + dynamic "cognito_options" { + for_each = var.cognito_authentication_enabled ? [true] : [] + content { + enabled = true + user_pool_id = var.cognito_user_pool_id + identity_pool_id = var.cognito_identity_pool_id + role_arn = var.cognito_iam_role_arn + } } log_publishing_options {