Skip to content

Commit b229b65

Browse files
authored
Fix crash in resource_kubernetes_pod_security_policy host_ports attribute (#932)
1 parent 694ae5a commit b229b65

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

kubernetes/resource_kubernetes_pod_security_policy_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ resource "kubernetes_pod_security_policy" "test" {
278278
max = 65535
279279
}
280280
}
281+
282+
host_ports {
283+
min = 0
284+
max = 65535
285+
}
281286
282287
read_only_root_filesystem = true
283288
}

kubernetes/structure_pod_security_policy_spec.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ func flattenHostPortRangeSlice(in []v1beta1.HostPortRange) []interface{} {
149149

150150
for k, v := range in {
151151
result[k] = map[string]interface{}{
152-
"min": v.Min,
153-
"max": v.Max,
152+
"min": int(v.Min),
153+
"max": int(v.Max),
154154
}
155155
}
156156

@@ -383,8 +383,8 @@ func expandHostPortRangeSlice(in []interface{}) []v1beta1.HostPortRange {
383383
for k, v := range in {
384384
if m, ok := v.(map[string]interface{}); ok {
385385
result[k] = v1beta1.HostPortRange{
386-
Min: m["min"].(int32),
387-
Max: m["max"].(int32),
386+
Min: int32(m["min"].(int)),
387+
Max: int32(m["max"].(int)),
388388
}
389389
}
390390
}

0 commit comments

Comments
 (0)