From d90172d2fd8e4368d3074e61738b7fb32475bab5 Mon Sep 17 00:00:00 2001 From: drewmullen Date: Tue, 12 Jul 2022 10:27:54 -0400 Subject: [PATCH 1/3] allow segments block bools to set specified values --- ...re_network_policy_document_data_source_test.go | 15 +++++++++++---- .../networkmanager/core_network_policy_model.go | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/internal/service/networkmanager/core_network_policy_document_data_source_test.go b/internal/service/networkmanager/core_network_policy_document_data_source_test.go index 98ce77bf041..5b174a0022f 100644 --- a/internal/service/networkmanager/core_network_policy_document_data_source_test.go +++ b/internal/service/networkmanager/core_network_policy_document_data_source_test.go @@ -76,7 +76,7 @@ data "aws_networkmanager_core_network_policy_document" "test" { segments { name = "AnotherGoodSegmentSpecification" description = "A good segment." - require_attachment_acceptance = true + require_attachment_acceptance = false isolate_attachments = false allow_filter = ["AllowThisSegment"] } @@ -99,12 +99,12 @@ data "aws_networkmanager_core_network_policy_document" "test" { segments { name = "b" require_attachment_acceptance = true - isolate_attachments = false + isolate_attachments = true } segments { name = "c" - require_attachment_acceptance = true isolate_attachments = false + require_attachment_acceptance = true } segment_actions { @@ -314,6 +314,7 @@ func testAccPolicyDocumentExpectedJSON() string { "us-east-1", "eu-west-1" ], + "isolate-attachments": false, "require-attachment-acceptance": true }, { @@ -322,29 +323,35 @@ func testAccPolicyDocumentExpectedJSON() string { "allow-filter": [ "AllowThisSegment" ], - "require-attachment-acceptance": true + "isolate-attachments": false, + "require-attachment-acceptance": false }, { "name": "AllowThisSegment", "deny-filter": [ "DenyThisSegment" ], + "isolate-attachments": false, "require-attachment-acceptance": true }, { "name": "DenyThisSegment", + "isolate-attachments": false, "require-attachment-acceptance": true }, { "name": "a", + "isolate-attachments": false, "require-attachment-acceptance": true }, { "name": "b", + "isolate-attachments": true, "require-attachment-acceptance": true }, { "name": "c", + "isolate-attachments": false, "require-attachment-acceptance": true } ], diff --git a/internal/service/networkmanager/core_network_policy_model.go b/internal/service/networkmanager/core_network_policy_model.go index 5695c47ed5a..1f793a143d9 100644 --- a/internal/service/networkmanager/core_network_policy_model.go +++ b/internal/service/networkmanager/core_network_policy_model.go @@ -51,8 +51,8 @@ type CoreNetworkPolicySegment struct { AllowFilter interface{} `json:"allow-filter,omitempty"` DenyFilter interface{} `json:"deny-filter,omitempty"` EdgeLocations interface{} `json:"edge-locations,omitempty"` - IsolateAttachments bool `json:"isolate-attachments,omitempty"` - RequireAttachmentAcceptance bool `json:"require-attachment-acceptance,omitempty"` + IsolateAttachments bool `json:"isolate-attachments"` + RequireAttachmentAcceptance bool `json:"require-attachment-acceptance"` } type CoreNetworkPolicyCoreNetworkConfiguration struct { From f6d1b0c7c468020937d2ccc8f71bee7d5022f7d0 Mon Sep 17 00:00:00 2001 From: drewmullen Date: Tue, 12 Jul 2022 10:38:01 -0400 Subject: [PATCH 2/3] core_network_policy_document bug entry --- .changelog/25789.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/25789.txt diff --git a/.changelog/25789.txt b/.changelog/25789.txt new file mode 100644 index 00000000000..fdf2e6098b2 --- /dev/null +++ b/.changelog/25789.txt @@ -0,0 +1,3 @@ +```release-note:bug +data-source/aws_networkmanager_core_network_policy_document: Fix bug where bool values in `segments` blocks weren't being included in json payloads +``` From 471922aa07ef2965fbd22863030ffa0cda084cc2 Mon Sep 17 00:00:00 2001 From: drewmullen Date: Tue, 12 Jul 2022 10:58:23 -0400 Subject: [PATCH 3/3] fix attachment_policy require_acceptance bool --- .../core_network_policy_document_data_source_test.go | 7 ++++--- .../service/networkmanager/core_network_policy_model.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/networkmanager/core_network_policy_document_data_source_test.go b/internal/service/networkmanager/core_network_policy_document_data_source_test.go index 5b174a0022f..e2062f0e6b2 100644 --- a/internal/service/networkmanager/core_network_policy_document_data_source_test.go +++ b/internal/service/networkmanager/core_network_policy_document_data_source_test.go @@ -249,7 +249,7 @@ data "aws_networkmanager_core_network_policy_document" "test" { action { association_method = "constant" segment = "GoodSegmentSpecification" - require_acceptance = true + require_acceptance = false } } @@ -360,7 +360,8 @@ func testAccPolicyDocumentExpectedJSON() string { "rule-number": 1, "action": { "association-method": "tag", - "tag-value-of-key": "segment" + "tag-value-of-key": "segment", + "require-acceptance": false }, "conditions": [ { @@ -442,7 +443,7 @@ func testAccPolicyDocumentExpectedJSON() string { "action": { "association-method": "constant", "segment": "GoodSegmentSpecification", - "require-acceptance": true + "require-acceptance": false }, "conditions": [ { diff --git a/internal/service/networkmanager/core_network_policy_model.go b/internal/service/networkmanager/core_network_policy_model.go index 1f793a143d9..dffa5494516 100644 --- a/internal/service/networkmanager/core_network_policy_model.go +++ b/internal/service/networkmanager/core_network_policy_model.go @@ -35,7 +35,7 @@ type CoreNetworkAttachmentPolicyAction struct { AssociationMethod string `json:"association-method,omitempty"` Segment string `json:"segment,omitempty"` TagValueOfKey string `json:"tag-value-of-key,omitempty"` - RequireAcceptance bool `json:"require-acceptance,omitempty"` + RequireAcceptance bool `json:"require-acceptance"` } type CoreNetworkAttachmentPolicyCondition struct {