diff --git a/README.md b/README.md index 766fb1bd..22562a09 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ You need the following permissions to run this module. |------|---------| | [terraform](#requirement\_terraform) | >= 1.3.0 | | [ibm](#requirement\_ibm) | >= 1.54.0, < 2.0.0 | +| [time](#requirement\_time) | >= 0.9.1 | ## Modules @@ -66,6 +67,7 @@ You need the following permissions to run this module. | [ibm_database.redis_database](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/database) | resource | | [ibm_iam_authorization_policy.kms_policy](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/iam_authorization_policy) | resource | | [ibm_resource_key.service_credentials](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_key) | resource | +| [time_sleep.wait_for_authorization_policy](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource | | [ibm_database_connection.database_connection](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/database_connection) | data source | ## Inputs diff --git a/main.tf b/main.tf index 8c6110aa..13cf4242 100644 --- a/main.tf +++ b/main.tf @@ -39,6 +39,13 @@ resource "ibm_iam_authorization_policy" "kms_policy" { roles = ["Reader"] } +# workaround for https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4478 +resource "time_sleep" "wait_for_authorization_policy" { + depends_on = [ibm_iam_authorization_policy.kms_policy] + + create_duration = "30s" +} + resource "ibm_database" "redis_database" { depends_on = [ibm_iam_authorization_policy.kms_policy] name = var.instance_name diff --git a/module-metadata.json b/module-metadata.json index 1a240d01..54281abd 100644 --- a/module-metadata.json +++ b/module-metadata.json @@ -379,6 +379,12 @@ "version_constraints": [ "\u003e= 1.54.0, \u003c 2.0.0" ] + }, + "time": { + "source": "hashicorp/time", + "version_constraints": [ + "\u003e= 0.9.1" + ] } }, "managed_resources": { @@ -403,7 +409,7 @@ }, "pos": { "filename": "main.tf", - "line": 42 + "line": 49 } }, "ibm_iam_authorization_policy.kms_policy": { @@ -435,7 +441,19 @@ }, "pos": { "filename": "main.tf", - "line": 178 + "line": 185 + } + }, + "time_sleep.wait_for_authorization_policy": { + "mode": "managed", + "type": "time_sleep", + "name": "wait_for_authorization_policy", + "provider": { + "name": "time" + }, + "pos": { + "filename": "main.tf", + "line": 43 } } }, @@ -455,7 +473,7 @@ }, "pos": { "filename": "main.tf", - "line": 206 + "line": 213 } } }, @@ -534,7 +552,7 @@ }, "pos": { "filename": "main.tf", - "line": 138 + "line": 145 } } } diff --git a/version.tf b/version.tf index dec6087d..450722dd 100644 --- a/version.tf +++ b/version.tf @@ -6,5 +6,9 @@ terraform { # Use "greater than or equal to" range in modules version = ">= 1.54.0, < 2.0.0" } + time = { + source = "hashicorp/time" + version = ">= 0.9.1" + } } }