-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix elbv2 target group read to workaround #2517
- Loading branch information
Showing
2 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,43 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Bradley <daniel@pulumi.com> | ||
Date: Fri, 12 May 2023 10:55:42 +0100 | ||
Subject: [PATCH 22/36] Fix elbv2 target group read | ||
From: Anton Tayanovskyy <anton@pulumi.com> | ||
Date: Fri, 19 Jan 2024 17:36:47 -0500 | ||
Subject: [PATCH 40/40] Fix elbv2 target group read to workaround #2517 | ||
|
||
Workaround for https://github.com/pulumi/pulumi-aws/issues/2517 | ||
Don't return single empty map. Return empty list instead. | ||
|
||
diff --git a/internal/service/elbv2/target_group.go b/internal/service/elbv2/target_group.go | ||
index da35f69df6..d5f04f4647 100644 | ||
index 388edc5ec7..e61259bfa2 100644 | ||
--- a/internal/service/elbv2/target_group.go | ||
+++ b/internal/service/elbv2/target_group.go | ||
@@ -1221,6 +1221,12 @@ func flattenTargetGroupFailover(attributes []*elbv2.TargetGroupAttribute) []inte | ||
} | ||
@@ -562,15 +562,15 @@ func resourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta i | ||
return sdkdiag.AppendErrorf(diags, "reading ELBv2 Target Group (%s) attributes: %s", d.Id(), err) | ||
} | ||
|
||
- if err := d.Set("stickiness", []interface{}{flattenTargetGroupStickinessAttributes(attributes, protocol)}); err != nil { | ||
+ if err := d.Set("stickiness", fix2517(flattenTargetGroupStickinessAttributes(attributes, protocol))); err != nil { | ||
return sdkdiag.AppendErrorf(diags, "setting stickiness: %s", err) | ||
} | ||
|
||
- if err := d.Set("target_failover", []interface{}{flattenTargetGroupTargetFailoverAttributes(attributes, protocol)}); err != nil { | ||
+ if err := d.Set("target_failover", fix2517(flattenTargetGroupTargetFailoverAttributes(attributes, protocol))); err != nil { | ||
return sdkdiag.AppendErrorf(diags, "setting target_failover: %s", err) | ||
} | ||
|
||
- if err := d.Set("target_health_state", []interface{}{flattenTargetGroupTargetHealthStateAttributes(attributes, protocol)}); err != nil { | ||
+ if err := d.Set("target_health_state", fix2517(flattenTargetGroupTargetHealthStateAttributes(attributes, protocol))); err != nil { | ||
return sdkdiag.AppendErrorf(diags, "setting target_health_state: %s", err) | ||
} | ||
|
||
+ // Workaround for https://github.com/pulumi/pulumi-aws/issues/2517 | ||
+ // Don't return single empty map. Return empty list instead. | ||
@@ -1385,3 +1385,13 @@ func runtimeValidations(d *schema.ResourceData, diags *diag.Diagnostics) { | ||
} | ||
} | ||
} | ||
+ | ||
+// Workaround for https://github.com/pulumi/pulumi-aws/issues/2517 | ||
+// | ||
+// Don't return single empty map. Return empty list instead. | ||
+func fix2517(m map[string]interface{}) []interface{} { | ||
+ if len(m) == 0 { | ||
+ return []interface{}{} | ||
+ } | ||
+ | ||
return []interface{}{m} | ||
} | ||
|
||
+ return []interface{}{m} | ||
+} |
Submodule upstream
updated
4755 files