Skip to content

Commit bfbbfc0

Browse files
committed
Make force_delete attribute of group policy resource importable
1 parent d8037a2 commit bfbbfc0

File tree

70 files changed

+158
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+158
-148
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## 1.1.1 (unreleaesd)
1+
## 1.2.0 (unreleaesd)
22

33
- Handle HTTP error code `400` correctly when trying to read non-existent resources
4+
- Make `force_delete` attribute of `meraki_network_group_policy` resource "importable"
45

56
## 1.1.0
67

docs/guides/changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ description: |-
77

88
# Changelog
99

10-
## 1.1.1 (unreleaesd)
10+
## 1.2.0 (unreleaesd)
1111

1212
- Handle HTTP error code `400` correctly when trying to read non-existent resources
13+
- Make `force_delete` attribute of `meraki_network_group_policy` resource "importable"
1314

1415
## 1.1.0
1516

docs/resources/network_group_policy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ resource "meraki_network_group_policy" "example" {
8585
scheduling_wednesday_to = "17:00"
8686
vlan_tagging_settings = "custom"
8787
vlan_tagging_vlan_id = "1"
88+
force_delete = true
8889
}
8990
```
9091

@@ -222,5 +223,5 @@ Required:
222223
Import is supported using the following syntax:
223224

224225
```shell
225-
terraform import meraki_network_group_policy.example "<network_id>,<id>"
226+
terraform import meraki_network_group_policy.example "<network_id>,<force_delete>,<id>"
226227
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
terraform import meraki_network_group_policy.example "<network_id>,<id>"
1+
terraform import meraki_network_group_policy.example "<network_id>,<force_delete>,<id>"

examples/resources/meraki_network_group_policy/resource.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ resource "meraki_network_group_policy" "example" {
7070
scheduling_wednesday_to = "17:00"
7171
vlan_tagging_settings = "custom"
7272
vlan_tagging_vlan_id = "1"
73+
force_delete = true
7374
}

gen/definitions/network_group_policy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ attributes:
346346
example: "1"
347347
- tf_name: force_delete
348348
type: Bool
349-
exclude_test: true
350349
description: If true, the system deletes the GP even if there are active clients using the GP. After deletion, active clients that were assigned to that Group Policy will be left without any policy applied. Default is false.
351350
example: "true"
352351
test_prerequisites: |

gen/templates/data_source_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,28 @@ func TestAccDataSourceMeraki{{camelCase .Name}}(t *testing.T) {
4343
var checks []resource.TestCheckFunc
4444
{{- $name := .Name }}
4545
{{- range .Attributes}}
46-
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed)}}
46+
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed) .ModelName}}
4747
{{- if isNestedListSetMap .}}
4848
{{- $parent0 := .}}
4949
{{- if len .TestTags}}
5050
if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
5151
{{- end}}
5252
{{- range .Attributes}}
53-
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed)}}
53+
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed) .ModelName}}
5454
{{- if isNestedListSetMap .}}
5555
{{- $parent1 := .}}
5656
{{- if len .TestTags}}
5757
if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
5858
{{- end}}
5959
{{- range .Attributes}}
60-
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed)}}
60+
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed) .ModelName}}
6161
{{- if isNestedListSetMap .}}
6262
{{- $parent2 := .}}
6363
{{- if len .TestTags}}
6464
if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
6565
{{- end}}
6666
{{- range .Attributes}}
67-
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed) (not (isSet .))}}
67+
{{- if and (not .WriteOnly) (not .ExcludeTest) (not .Value) (not .TestValue) (not .Computed) .ModelName (not (isSet .))}}
6868
{{- if len .TestTags}}
6969
if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
7070
checks = append(checks, resource.TestCheckResourceAttr("data.meraki_{{snakeCase $name}}.test", "{{buildTestPath $parent0 $parent1 $parent2}}{{.TfName}}{{if isList .}}.0{{end}}", "{{.Example}}"))

gen/templates/import.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
terraform import meraki_{{snakeCase .Name}}.example "{{$idRef := false}}{{range $i, $e := .Attributes}}{{if or .Reference .Id}}{{$idRef = true}}{{if $i}},{{end}}<{{.TfName}}>{{end}}{{end}}{{if not (hasId .Attributes)}}{{if $idRef}},{{end}}<id>{{end}}"
1+
terraform import meraki_{{snakeCase .Name}}.example "{{range $i, $e := (importAttributes .)}}{{if $i}},{{end}}<{{.TfName}}>{{end}}"

gen/templates/resource.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -595,25 +595,20 @@ func (r *{{camelCase .Name}}Resource) Delete(ctx context.Context, req resource.D
595595
func (r *{{camelCase .Name}}Resource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
596596
idParts := strings.Split(req.ID, ",")
597597

598-
if len(idParts) != {{importParts .}}{{range $index := (iterate (importParts .))}} || idParts[{{$index}}] == ""{{end}} {
598+
if len(idParts) != {{len (importAttributes .)}}{{range $index, $attr := (importAttributes .)}} || idParts[{{$index}}] == ""{{end}} {
599599
resp.Diagnostics.AddError(
600600
"Unexpected Import Identifier",
601-
fmt.Sprintf("Expected import identifier with format: {{$idRef := false}}{{range $i, $e := .Attributes}}{{if or .Reference .Id}}{{$idRef = true}}{{if $i}},{{end}}<{{.TfName}}>{{end}}{{end}}{{if not (hasId .Attributes)}}{{if $idRef}},{{end}}<id>{{end}}. Got: %q", req.ID),
601+
fmt.Sprintf("Expected import identifier with format: {{range $i, $e := (importAttributes .)}}{{if $i}},{{end}}<{{.TfName}}>{{end}}. Got: %q", req.ID),
602602
)
603603
return
604604
}
605605

606-
{{- range $index, $attr := .Attributes}}
607-
{{- if or $attr.Reference $attr.Id}}
608-
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("{{$attr.TfName}}"), idParts[{{$index}}])...)
606+
{{- range $index, $attr := (importAttributes .)}}
607+
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("{{.TfName}}"), {{if eq .Type "Bool"}}helpers.Must(strconv.ParseBool(idParts[{{$index}}])){{else if eq .Type "Int64"}}helpers.Must(strconv.ParseInt(idParts[{{$index}}])){{else if eq .Type "Float64"}}helpers.Must(strconv.ParseFloat(idParts[{{$index}}])){{else}}idParts[{{$index}}]{{end}})...)
609608
{{- if $attr.Id}}
610609
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), idParts[{{$index}}])...)
611610
{{- end}}
612611
{{- end}}
613-
{{- end}}
614-
{{- if not (hasId .Attributes)}}
615-
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), idParts[{{subtract (importParts .) 1}}])...)
616-
{{- end}}
617612

618613
helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics)
619614
}

gen/templates/resource_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,11 @@ func meraki{{camelCase .Name}}ImportStateIdFunc(resourceName string) resource.Im
164164
return func(s *terraform.State) (string, error) {
165165
primary := s.RootModule().Resources[resourceName].Primary
166166

167-
{{- range .Attributes}}
168-
{{- if or .Reference .Id}}
167+
{{- range (importAttributes .)}}
169168
{{toGoName .TfName}} := primary.Attributes["{{.TfName}}"]
170169
{{- end}}
171-
{{- end}}
172-
{{- if not (hasId .Attributes)}}
173-
id := primary.Attributes["id"]
174-
{{- end}}
175170

176-
return fmt.Sprintf("{{range $i := (iterate (importParts .))}}{{if $i}},{{end}}%s{{end}}", {{$idRef := false}}{{range $i, $e := .Attributes}}{{if or .Reference .Id}}{{$idRef = true}}{{if $i}},{{end}}{{toGoName .TfName}}{{end}}{{end}}{{if not (hasId .Attributes)}}{{if $idRef}},{{end}}id{{end}}), nil
171+
return fmt.Sprintf("{{range $i, $e := (importAttributes .)}}{{if $i}},{{end}}%s{{end}}", {{range $i, $e := (importAttributes .)}}{{if $i}},{{end}}{{toGoName .TfName}}{{end}}), nil
177172
}
178173
}
179174

gen/yamlconfig/main.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,23 @@ func IsNestedMap(attribute YamlConfigAttribute) bool {
329329
return false
330330
}
331331

332-
// Templating helper function to return number of import parts
333-
func ImportParts(config YamlConfig) int {
334-
parts := 0
332+
// Templating helper function to return all import attributes
333+
func ImportAttributes(config YamlConfig) []YamlConfigAttribute {
334+
attributes := []YamlConfigAttribute{}
335335
for _, attr := range config.Attributes {
336336
if attr.Reference {
337-
parts += 1
337+
attributes = append(attributes, attr)
338338
} else if attr.Id {
339-
parts += 1
339+
attributes = append(attributes, attr)
340+
} else if attr.ModelName == "" {
341+
attributes = append(attributes, attr)
340342
}
341343
}
342344
if !HasId(config.Attributes) {
343-
parts += 1
345+
attributes = append(attributes, YamlConfigAttribute{TfName: "id"})
344346
}
345347

346-
return parts
348+
return attributes
347349
}
348350

349351
// Templating helper function to subtract one number from another
@@ -454,7 +456,7 @@ var Functions = template.FuncMap{
454456
"isNestedList": IsNestedList,
455457
"isNestedSet": IsNestedSet,
456458
"isNestedMap": IsNestedMap,
457-
"importParts": ImportParts,
459+
"importAttributes": ImportAttributes,
458460
"subtract": Subtract,
459461
"iterate": Iterate,
460462
"getImportExcludes": GetImportExcludes,

internal/provider/data_source_meraki_network_group_policy_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func testAccDataSourceMerakiNetworkGroupPolicyConfig() string {
179179
config += ` scheduling_wednesday_to = "17:00"` + "\n"
180180
config += ` vlan_tagging_settings = "custom"` + "\n"
181181
config += ` vlan_tagging_vlan_id = "1"` + "\n"
182+
config += ` force_delete = true` + "\n"
182183
config += `}` + "\n"
183184

184185
config += `
@@ -254,6 +255,7 @@ func testAccNamedDataSourceMerakiNetworkGroupPolicyConfig() string {
254255
config += ` scheduling_wednesday_to = "17:00"` + "\n"
255256
config += ` vlan_tagging_settings = "custom"` + "\n"
256257
config += ` vlan_tagging_vlan_id = "1"` + "\n"
258+
config += ` force_delete = true` + "\n"
257259
config += `}` + "\n"
258260

259261
config += `

internal/provider/helpers/utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,10 @@ func ToLower(s basetypes.StringValue) basetypes.StringValue {
8888

8989
return types.StringValue(strings.ToLower(s.ValueString()))
9090
}
91+
92+
func Must[T any](obj T, err error) T {
93+
if err != nil {
94+
panic(err)
95+
}
96+
return obj
97+
}

internal/provider/resource_meraki_appliance_dns_local_profile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ func merakiApplianceDNSLocalProfileImportStateIdFunc(resourceName string) resour
7272
return func(s *terraform.State) (string, error) {
7373
primary := s.RootModule().Resources[resourceName].Primary
7474
OrganizationId := primary.Attributes["organization_id"]
75-
id := primary.Attributes["id"]
75+
Id := primary.Attributes["id"]
7676

77-
return fmt.Sprintf("%s,%s", OrganizationId, id), nil
77+
return fmt.Sprintf("%s,%s", OrganizationId, Id), nil
7878
}
7979
}
8080

internal/provider/resource_meraki_appliance_dns_local_record_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ func merakiApplianceDNSLocalRecordImportStateIdFunc(resourceName string) resourc
7373
return func(s *terraform.State) (string, error) {
7474
primary := s.RootModule().Resources[resourceName].Primary
7575
OrganizationId := primary.Attributes["organization_id"]
76-
id := primary.Attributes["id"]
76+
Id := primary.Attributes["id"]
7777

78-
return fmt.Sprintf("%s,%s", OrganizationId, id), nil
78+
return fmt.Sprintf("%s,%s", OrganizationId, Id), nil
7979
}
8080
}
8181

internal/provider/resource_meraki_appliance_dns_split_profile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ func merakiApplianceDNSSplitProfileImportStateIdFunc(resourceName string) resour
7474
return func(s *terraform.State) (string, error) {
7575
primary := s.RootModule().Resources[resourceName].Primary
7676
OrganizationId := primary.Attributes["organization_id"]
77-
id := primary.Attributes["id"]
77+
Id := primary.Attributes["id"]
7878

79-
return fmt.Sprintf("%s,%s", OrganizationId, id), nil
79+
return fmt.Sprintf("%s,%s", OrganizationId, Id), nil
8080
}
8181
}
8282

internal/provider/resource_meraki_appliance_prefix_delegated_static_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ func merakiAppliancePrefixDelegatedStaticImportStateIdFunc(resourceName string)
7575
return func(s *terraform.State) (string, error) {
7676
primary := s.RootModule().Resources[resourceName].Primary
7777
NetworkId := primary.Attributes["network_id"]
78-
id := primary.Attributes["id"]
78+
Id := primary.Attributes["id"]
7979

80-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
80+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
8181
}
8282
}
8383

internal/provider/resource_meraki_appliance_rf_profile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ func merakiApplianceRFProfileImportStateIdFunc(resourceName string) resource.Imp
8484
return func(s *terraform.State) (string, error) {
8585
primary := s.RootModule().Resources[resourceName].Primary
8686
NetworkId := primary.Attributes["network_id"]
87-
id := primary.Attributes["id"]
87+
Id := primary.Attributes["id"]
8888

89-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
89+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
9090
}
9191
}
9292

internal/provider/resource_meraki_appliance_static_route_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ func merakiApplianceStaticRouteImportStateIdFunc(resourceName string) resource.I
7474
return func(s *terraform.State) (string, error) {
7575
primary := s.RootModule().Resources[resourceName].Primary
7676
NetworkId := primary.Attributes["network_id"]
77-
id := primary.Attributes["id"]
77+
Id := primary.Attributes["id"]
7878

79-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
79+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
8080
}
8181
}
8282

internal/provider/resource_meraki_appliance_traffic_shaping_custom_performance_class_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ func merakiApplianceTrafficShapingCustomPerformanceClassImportStateIdFunc(resour
7575
return func(s *terraform.State) (string, error) {
7676
primary := s.RootModule().Resources[resourceName].Primary
7777
NetworkId := primary.Attributes["network_id"]
78-
id := primary.Attributes["id"]
78+
Id := primary.Attributes["id"]
7979

80-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
80+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
8181
}
8282
}
8383

internal/provider/resource_meraki_appliance_vlan_dhcp_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ func merakiApplianceVLANDHCPImportStateIdFunc(resourceName string) resource.Impo
6868
return func(s *terraform.State) (string, error) {
6969
primary := s.RootModule().Resources[resourceName].Primary
7070
NetworkId := primary.Attributes["network_id"]
71-
id := primary.Attributes["id"]
71+
Id := primary.Attributes["id"]
7272

73-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
73+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
7474
}
7575
}
7676

internal/provider/resource_meraki_appliance_vlan_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ func merakiApplianceVLANImportStateIdFunc(resourceName string) resource.ImportSt
8181
return func(s *terraform.State) (string, error) {
8282
primary := s.RootModule().Resources[resourceName].Primary
8383
NetworkId := primary.Attributes["network_id"]
84-
id := primary.Attributes["id"]
84+
Id := primary.Attributes["id"]
8585

86-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
86+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
8787
}
8888
}
8989

internal/provider/resource_meraki_camera_quality_retention_profile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ func merakiCameraQualityRetentionProfileImportStateIdFunc(resourceName string) r
127127
return func(s *terraform.State) (string, error) {
128128
primary := s.RootModule().Resources[resourceName].Primary
129129
NetworkId := primary.Attributes["network_id"]
130-
id := primary.Attributes["id"]
130+
Id := primary.Attributes["id"]
131131

132-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
132+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
133133
}
134134
}
135135

internal/provider/resource_meraki_camera_role_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ func merakiCameraRoleImportStateIdFunc(resourceName string) resource.ImportState
7272
return func(s *terraform.State) (string, error) {
7373
primary := s.RootModule().Resources[resourceName].Primary
7474
OrganizationId := primary.Attributes["organization_id"]
75-
id := primary.Attributes["id"]
75+
Id := primary.Attributes["id"]
7676

77-
return fmt.Sprintf("%s,%s", OrganizationId, id), nil
77+
return fmt.Sprintf("%s,%s", OrganizationId, Id), nil
7878
}
7979
}
8080

internal/provider/resource_meraki_camera_wireless_profile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ func merakiCameraWirelessProfileImportStateIdFunc(resourceName string) resource.
7777
return func(s *terraform.State) (string, error) {
7878
primary := s.RootModule().Resources[resourceName].Primary
7979
NetworkId := primary.Attributes["network_id"]
80-
id := primary.Attributes["id"]
80+
Id := primary.Attributes["id"]
8181

82-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
82+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
8383
}
8484
}
8585

internal/provider/resource_meraki_network_floor_plan_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ func merakiNetworkFloorPlanImportStateIdFunc(resourceName string) resource.Impor
7373
return func(s *terraform.State) (string, error) {
7474
primary := s.RootModule().Resources[resourceName].Primary
7575
NetworkId := primary.Attributes["network_id"]
76-
id := primary.Attributes["id"]
76+
Id := primary.Attributes["id"]
7777

78-
return fmt.Sprintf("%s,%s", NetworkId, id), nil
78+
return fmt.Sprintf("%s,%s", NetworkId, Id), nil
7979
}
8080
}
8181

internal/provider/resource_meraki_network_group_policy.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"context"
2323
"fmt"
2424
"net/url"
25+
"strconv"
2526
"strings"
2627

2728
"github.com/CiscoDevNet/terraform-provider-meraki/internal/provider/helpers"
@@ -537,15 +538,16 @@ func (r *NetworkGroupPolicyResource) Delete(ctx context.Context, req resource.De
537538
func (r *NetworkGroupPolicyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
538539
idParts := strings.Split(req.ID, ",")
539540

540-
if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" {
541+
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
541542
resp.Diagnostics.AddError(
542543
"Unexpected Import Identifier",
543-
fmt.Sprintf("Expected import identifier with format: <network_id>,<id>. Got: %q", req.ID),
544+
fmt.Sprintf("Expected import identifier with format: <network_id>,<force_delete>,<id>. Got: %q", req.ID),
544545
)
545546
return
546547
}
547548
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("network_id"), idParts[0])...)
548-
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), idParts[1])...)
549+
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("force_delete"), helpers.Must(strconv.ParseBool(idParts[1])))...)
550+
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), idParts[2])...)
549551

550552
helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics)
551553
}

0 commit comments

Comments
 (0)