Skip to content

Commit d7998d2

Browse files
Fix issue #125 (#130)
1 parent 06d7317 commit d7998d2

File tree

8 files changed

+21
-1
lines changed

8 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.13 (unreleased)
2+
3+
- Fix issue with catalystcenter_ip_pool forces replacement on `catalystcenter_ip_pool` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/125)
4+
15
## 0.1.12
26

37
- Change default timeout for asynchronous operations to 60 seconds and introduce provider attribute `max_timeout` to set a custom timeout

docs/guides/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ description: |-
77

88
# Changelog
99

10+
## 0.1.13 (unreleased)
11+
12+
- Fix issue with catalystcenter_ip_pool forces replacement on `catalystcenter_ip_pool` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/125)
13+
1014
## 0.1.12
1115

1216
- Change default timeout for asynchronous operations to 60 seconds and introduce provider attribute `max_timeout` to set a custom timeout

gen/definitions/ip_pool.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: IP Pool
33
rest_endpoint: /api/v2/ippool
44
get_requires_id: true
55
id_from_query_path: response
6+
get_extra_query_params: "?limit=1000"
67
doc_category: Network Settings
78
attributes:
89
- model_name: ipPoolName

gen/templates/resource.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ func (r *{{camelCase .Name}}Resource) Create(ctx context.Context, req resource.C
451451
params += {{$queryParams}}
452452
{{- end}}
453453
{{- end}}
454+
{{- if .GetExtraQueryParams}}
455+
params += "{{.GetExtraQueryParams}}"
456+
{{- end}}
454457
res, err = r.client.Get({{if .GetRestEndpoint}}"{{.GetRestEndpoint}}"{{else}}plan.getPath(){{end}} + params)
455458
if err != nil {
456459
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))

internal/provider/data_source_catalystcenter_ip_pool.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (d *IPPoolDataSource) Read(ctx context.Context, req datasource.ReadRequest,
133133

134134
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
135135
if config.Id.IsNull() && !config.Name.IsNull() {
136-
res, err := d.client.Get(config.getPath())
136+
res, err := d.client.Get(config.getPath() + "?limit=1000")
137137
if err != nil {
138138
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve objects, got error: %s", err))
139139
return
@@ -157,6 +157,7 @@ func (d *IPPoolDataSource) Read(ctx context.Context, req datasource.ReadRequest,
157157

158158
params := ""
159159
params += "/" + url.QueryEscape(config.Id.ValueString())
160+
params += "?limit=1000"
160161
res, err := d.client.Get(config.getPath() + params)
161162
if err != nil {
162163
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))

internal/provider/resource_catalystcenter_ip_pool.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ func (r *IPPoolResource) Create(ctx context.Context, req resource.CreateRequest,
152152
return
153153
}
154154
params = ""
155+
params += "?limit=1000"
155156
res, err = r.client.Get(plan.getPath() + params)
156157
if err != nil {
157158
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
@@ -182,6 +183,7 @@ func (r *IPPoolResource) Read(ctx context.Context, req resource.ReadRequest, res
182183

183184
params := ""
184185
params += "/" + url.QueryEscape(state.Id.ValueString())
186+
params += "?limit=1000"
185187
res, err := r.client.Get(state.getPath() + params)
186188
if err != nil && strings.Contains(err.Error(), "StatusCode 404") {
187189
resp.State.RemoveResource(ctx)

internal/provider/resource_catalystcenter_network_profile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ func (r *NetworkProfileResource) Create(ctx context.Context, req resource.Create
148148
return
149149
}
150150
params = ""
151+
params += "?populated=true"
151152
res, err = r.client.Get(plan.getPath() + params)
152153
if err != nil {
153154
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))

templates/guides/changelog.md.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ description: |-
77

88
# Changelog
99

10+
## 0.1.13 (unreleased)
11+
12+
- Fix issue with catalystcenter_ip_pool forces replacement on `catalystcenter_ip_pool` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/125)
13+
1014
## 0.1.12
1115

1216
- Change default timeout for asynchronous operations to 60 seconds and introduce provider attribute `max_timeout` to set a custom timeout

0 commit comments

Comments
 (0)