Skip to content

Commit 842803d

Browse files
authored
1 parent 07393c0 commit 842803d

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/terraform-plugin-go v0.25.0
1212
github.com/hashicorp/terraform-plugin-log v0.9.0
1313
github.com/iancoleman/strcase v0.3.0
14-
github.com/pomerium/enterprise-client-go v0.28.1-0.20250124224424-4bf492f69b09
14+
github.com/pomerium/enterprise-client-go v0.28.1-0.20250124233741-2592eb1169f7
1515
github.com/pomerium/pomerium v0.28.1-0.20250122205906-0bd6d8cc8315
1616
github.com/rs/zerolog v1.33.0
1717
github.com/stretchr/testify v1.10.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
229229
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
230230
github.com/pomerium/csrf v1.7.0 h1:Qp4t6oyEod3svQtKfJZs589mdUTWKVf7q0PgCKYCshY=
231231
github.com/pomerium/csrf v1.7.0/go.mod h1:hAPZV47mEj2T9xFs+ysbum4l7SF1IdrryYaY6PdoIqw=
232-
github.com/pomerium/enterprise-client-go v0.28.1-0.20250124224424-4bf492f69b09 h1:7728buRUdPGSUMtNP2TRYyxsLfwccp773rFUf9Rxgqc=
233-
github.com/pomerium/enterprise-client-go v0.28.1-0.20250124224424-4bf492f69b09/go.mod h1:fnT1uLizb7e1aodN9SqSiqg6iYlWoppWFdaPlSR5eKc=
232+
github.com/pomerium/enterprise-client-go v0.28.1-0.20250124233741-2592eb1169f7 h1:m5rq102yZxD4UWUfyq5M0+butxmhuIeh5STMjMSQzJI=
233+
github.com/pomerium/enterprise-client-go v0.28.1-0.20250124233741-2592eb1169f7/go.mod h1:fnT1uLizb7e1aodN9SqSiqg6iYlWoppWFdaPlSR5eKc=
234234
github.com/pomerium/pomerium v0.28.1-0.20250122205906-0bd6d8cc8315 h1:pdCpEr39m9UomjVkTp17Q4qeTbDZj7yxEffdBXZADe4=
235235
github.com/pomerium/pomerium v0.28.1-0.20250122205906-0bd6d8cc8315/go.mod h1:ujclJDq2BGZuSe2/9Lz2w4MpTVIR8DrR05qyjk1OcsU=
236236
github.com/pomerium/protoutil v0.0.0-20240813175624-47b7ac43ff46 h1:NRTg8JOXCxcIA1lAgD74iYud0rbshbWOB3Ou4+Huil8=

internal/provider/convert.go

+18
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,21 @@ func ToByteSlice(src types.String) []byte {
232232
}
233233
return []byte(val)
234234
}
235+
236+
// StringSliceExclude returns a new slice with elements from s1 that are not in s2
237+
func StringSliceExclude(s1, s2 []string) []string {
238+
if len(s1) == 0 || len(s2) == 0 {
239+
return s1
240+
}
241+
m := make(map[string]struct{}, len(s2))
242+
for _, v := range s2 {
243+
m[v] = struct{}{}
244+
}
245+
var result []string
246+
for _, v := range s1 {
247+
if _, ok := m[v]; !ok {
248+
result = append(result, v)
249+
}
250+
}
251+
return result
252+
}

internal/provider/route_model.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func ConvertRouteFromPB(
117117
}
118118
dst.To = types.ListValueMust(types.StringType, toList)
119119

120-
dst.Policies = FromStringSlice(src.PolicyIds)
120+
dst.Policies = FromStringSlice(StringSliceExclude(src.PolicyIds, src.EnforcedPolicyIds))
121121
dst.StatName = types.StringValue(src.StatName)
122122
dst.Prefix = types.StringPointerValue(src.Prefix)
123123
dst.Path = types.StringPointerValue(src.Path)

0 commit comments

Comments
 (0)