Skip to content

Commit

Permalink
fix: add wait/depends on for cos auth policy (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewLemmond authored Oct 15, 2024
1 parent ba48bc7 commit fb320fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/cloud_logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ No modules.
| [ibm_resource_instance.cloud_logs](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_instance) | resource |
| [ibm_resource_tag.cloud_logs_tag](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_tag) | resource |
| [random_string.random_tenant_suffix](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |
| [time_sleep.wait_for_cos_authorization_policy](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [time_sleep.wait_for_en_authorization_policy](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [ibm_iam_account_settings.iam_account_settings](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/iam_account_settings) | data source |

Expand Down
8 changes: 8 additions & 0 deletions modules/cloud_logs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ locals {
# Cloud Logs
resource "ibm_resource_instance" "cloud_logs" {
depends_on = [time_sleep.wait_for_cos_authorization_policy]
name = local.instance_name
resource_group_id = var.resource_group_id
service = "logs"
Expand Down Expand Up @@ -73,6 +74,13 @@ resource "ibm_iam_authorization_policy" "cos_policy" {
}
}

resource "time_sleep" "wait_for_cos_authorization_policy" {
depends_on = [ibm_iam_authorization_policy.cos_policy]
# trigger once if any of the buckets create an auth policy
count = anytrue([for _, bucket in var.data_storage : bucket.enabled && !bucket.skip_cos_auth_policy]) ? 1 : 0
create_duration = "30s"
}

##############################################################################
# EN Integration
##############################################################################
Expand Down

0 comments on commit fb320fd

Please sign in to comment.