Skip to content

Commit 462be95

Browse files
authored
Fix turbot_policy_pack_attachment to parse the ID correctly while reading the policy pack. Closes #181 (#182)
1 parent e6e5677 commit 462be95

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.11.2 (September 20, 2024)
2+
3+
BUG FIXES:
4+
5+
* `resource/turbot_policy_pack_attachment`: terraform apply failed to detect existing Policy Pack attachments. ([#181](https://github.com/turbot/terraform-provider-turbot/issues/181))
6+
17
## 1.11.1 (July 15, 2024)
28

39
DOCUMENTATION:

scripts/generate-dev-overrides.sh

100644100755
File mode changed.

turbot/resource_turbot_policy_pack_attachment.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ func buildPolicyPackId(policyPack, resource string) string {
135135
}
136136

137137
func parsePolicyPackId(id string) (policyPack, resource string) {
138-
segments := strings.Split(id, "_")
139-
policyPack = segments[0]
140-
resource = segments[1]
138+
// Get the index of the first underscore
139+
index := strings.Index(id, "_")
140+
policyPack = id[:index]
141+
resource = id[index+1:]
141142
return
142143
}

0 commit comments

Comments
 (0)