Skip to content

Commit

Permalink
fix: added missing depends_on for s2s auth policy creation when creat…
Browse files Browse the repository at this point in the history
…ing ATracker route with COS target (#475)

Co-authored-by: Md Anam Raihan <Md.Anam.Raihan@ibm.com>
  • Loading branch information
iamar7 and Md Anam Raihan authored Apr 2, 2024
1 parent 9b87fe1 commit 17df111
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2024-01-05T04:20:26Z",
"generated_at": "2024-03-29T19:38:40Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -126,7 +126,7 @@
"hashed_secret": "3bd02b996f65f3548c1a0b5d93b00bfa7c88341a",
"is_secret": true,
"is_verified": false,
"line_number": 82,
"line_number": 84,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down
2 changes: 2 additions & 0 deletions modules/activity_tracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module "activity_tracker" {
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0, < 1.7.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.56.1, < 2.0.0 |
| <a name="requirement_logdna"></a> [logdna](#requirement\_logdna) | >= 1.14.2, < 2.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.9.1, < 1.0.0 |

### Modules

Expand All @@ -66,6 +67,7 @@ No modules.
| [ibm_resource_key.resource_key](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_key) | resource |
| [ibm_resource_tag.activity_tracker_tag](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_tag) | resource |
| [logdna_archive.archive_config](https://registry.terraform.io/providers/logdna/logdna/latest/docs/resources/archive) | resource |
| [time_sleep.wait_for_authorization_policy](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |

### Inputs

Expand Down
8 changes: 7 additions & 1 deletion modules/activity_tracker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ resource "logdna_archive" "archive_config" {
# Activity Tracker Event Routing
#########################################################################

resource "time_sleep" "wait_for_authorization_policy" {
depends_on = [ibm_iam_authorization_policy.atracker_cos]
create_duration = "30s"
}

# atracker to COS s2s auth policy
resource "ibm_iam_authorization_policy" "atracker_cos" {
for_each = nonsensitive({ for target in var.cos_targets : target.target_name => target if target.service_to_service_enabled && !target.skip_atracker_cos_iam_auth_policy })
Expand All @@ -62,7 +67,8 @@ resource "ibm_iam_authorization_policy" "atracker_cos" {

# COS targets
resource "ibm_atracker_target" "atracker_cos_targets" {
for_each = nonsensitive({ for target in var.cos_targets : target.target_name => target })
depends_on = [time_sleep.wait_for_authorization_policy]
for_each = nonsensitive({ for target in var.cos_targets : target.target_name => target })
cos_endpoint {
endpoint = each.value.endpoint
bucket = each.value.bucket_name
Expand Down
4 changes: 4 additions & 0 deletions modules/activity_tracker/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ terraform {
version = ">= 1.14.2, < 2.0.0"
configuration_aliases = [logdna.at]
}
time = {
source = "hashicorp/time"
version = ">= 0.9.1, < 1.0.0"
}
}
}

0 comments on commit 17df111

Please sign in to comment.