Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit c9df134

Browse files
committed
Enforce connector property ordering for idempotent generation
1 parent 259eccb commit c9df134

3 files changed

Lines changed: 86 additions & 79 deletions

File tree

example/output/davinci_connection_property_vars.tf

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ variable "davinci_connection_flowconnector__2581eb287bb1d9bd29ae9886d675f89f_pem
2929
// Properties for the "Flow Conductor" connector, with connector ID flowConnector.
3030
// Terraform Resource: davinci_connection.flowconnector__33329a264e268ab31fb19637debf1ea3
3131

32-
// The 'Public Key' property for the connector named 'Flow Conductor' with connector ID 'flowConnector'. pem public key
33-
variable "davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_pemPublicKey" {
34-
type = string
35-
36-
description = "The 'Public Key' property for the connector named 'Flow Conductor' with connector ID 'flowConnector'. pem public key"
37-
default = null
38-
}
39-
4032
// The 'Enforce Signed Token' property for the connector named 'Flow Conductor' with connector ID 'flowConnector'.
4133
variable "davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_enforcedSignedToken" {
4234
type = bool
@@ -53,17 +45,17 @@ variable "davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_inp
5345
default = null
5446
}
5547

56-
// Properties for the "Http" connector, with connector ID httpConnector.
57-
// Terraform Resource: davinci_connection.httpconnector__867ed4363b2bc21c860085ad2baa817d
58-
59-
// The 'Trusted Sites' property for the connector named 'Http' with connector ID 'httpConnector'. Enter the hostname for the trusted sites that host your HTML. Note: Ensure that the content hosted on these sites can be trusted and that publishing safeguards are in place to prevent unexpected issues.
60-
variable "davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_whiteList" {
48+
// The 'Public Key' property for the connector named 'Flow Conductor' with connector ID 'flowConnector'. pem public key
49+
variable "davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_pemPublicKey" {
6150
type = string
6251

63-
description = "The 'Trusted Sites' property for the connector named 'Http' with connector ID 'httpConnector'. Enter the hostname for the trusted sites that host your HTML. Note: Ensure that the content hosted on these sites can be trusted and that publishing safeguards are in place to prevent unexpected issues."
52+
description = "The 'Public Key' property for the connector named 'Flow Conductor' with connector ID 'flowConnector'. pem public key"
6453
default = null
6554
}
6655

56+
// Properties for the "Http" connector, with connector ID httpConnector.
57+
// Terraform Resource: davinci_connection.httpconnector__867ed4363b2bc21c860085ad2baa817d
58+
6759
// The 'Select an OpenID token management connection for signed HTTP responses.' property for the connector named 'Http' with connector ID 'httpConnector'.
6860
variable "davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_connectionId" {
6961
type = string
@@ -88,9 +80,33 @@ variable "davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_rec
8880
default = null
8981
}
9082

83+
// The 'Trusted Sites' property for the connector named 'Http' with connector ID 'httpConnector'. Enter the hostname for the trusted sites that host your HTML. Note: Ensure that the content hosted on these sites can be trusted and that publishing safeguards are in place to prevent unexpected issues.
84+
variable "davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_whiteList" {
85+
type = string
86+
87+
description = "The 'Trusted Sites' property for the connector named 'Http' with connector ID 'httpConnector'. Enter the hostname for the trusted sites that host your HTML. Note: Ensure that the content hosted on these sites can be trusted and that publishing safeguards are in place to prevent unexpected issues."
88+
default = null
89+
}
90+
9191
// Properties for the "PingOne Notifications" connector, with connector ID notificationsConnector.
9292
// Terraform Resource: davinci_connection.notificationsconnector__cacf3d2861657174d93cbf445d55797a
9393

94+
// The 'Client ID' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client ID of your PingOne Worker application.
95+
variable "davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientId" {
96+
type = string
97+
98+
description = "The 'Client ID' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client ID of your PingOne Worker application."
99+
default = null
100+
}
101+
102+
// The 'Client Secret' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client Secret of your PingOne Worker application.
103+
variable "davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientSecret" {
104+
type = string
105+
106+
description = "The 'Client Secret' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client Secret of your PingOne Worker application."
107+
default = null
108+
}
109+
94110
// The 'Environment ID' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. Your PingOne Environment ID.
95111
variable "davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_envId" {
96112
type = string
@@ -115,25 +131,17 @@ variable "davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d5
115131
default = null
116132
}
117133

118-
// The 'Client ID' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client ID of your PingOne Worker application.
119-
variable "davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientId" {
120-
type = string
121-
122-
description = "The 'Client ID' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client ID of your PingOne Worker application."
123-
default = null
124-
}
134+
// Properties for the "PingOne MFA" connector, with connector ID pingOneMfaConnector.
135+
// Terraform Resource: davinci_connection.pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949
125136

126-
// The 'Client Secret' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client Secret of your PingOne Worker application.
127-
variable "davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientSecret" {
137+
// The 'Client ID' property for the connector named 'PingOne MFA' with connector ID 'pingOneMfaConnector'. The Client ID of your PingOne Worker application.
138+
variable "davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientId" {
128139
type = string
129140

130-
description = "The 'Client Secret' property for the connector named 'PingOne Notifications' with connector ID 'notificationsConnector'. The Client Secret of your PingOne Worker application."
141+
description = "The 'Client ID' property for the connector named 'PingOne MFA' with connector ID 'pingOneMfaConnector'. The Client ID of your PingOne Worker application."
131142
default = null
132143
}
133144

134-
// Properties for the "PingOne MFA" connector, with connector ID pingOneMfaConnector.
135-
// Terraform Resource: davinci_connection.pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949
136-
137145
// The 'Client Secret' property for the connector named 'PingOne MFA' with connector ID 'pingOneMfaConnector'. The Client Secret of your PingOne Worker application.
138146
variable "davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientSecret" {
139147
type = string
@@ -166,14 +174,6 @@ variable "davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c9
166174
default = null
167175
}
168176

169-
// The 'Client ID' property for the connector named 'PingOne MFA' with connector ID 'pingOneMfaConnector'. The Client ID of your PingOne Worker application.
170-
variable "davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientId" {
171-
type = string
172-
173-
description = "The 'Client ID' property for the connector named 'PingOne MFA' with connector ID 'pingOneMfaConnector'. The Client ID of your PingOne Worker application."
174-
default = null
175-
}
176-
177177
// Properties for the "PingOne Protect" connector, with connector ID pingOneRiskConnector.
178178
// Terraform Resource: davinci_connection.pingoneriskconnector__292873d5ceea806d81373ed0341b5c88
179179

@@ -212,6 +212,14 @@ variable "davinci_connection_pingoneriskconnector__292873d5ceea806d81373ed0341b5
212212
// Properties for the "PingOne" connector, with connector ID pingOneSSOConnector.
213213
// Terraform Resource: davinci_connection.pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb
214214

215+
// The 'Client ID' property for the connector named 'PingOne' with connector ID 'pingOneSSOConnector'. The Client ID of your PingOne Worker application.
216+
variable "davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientId" {
217+
type = string
218+
219+
description = "The 'Client ID' property for the connector named 'PingOne' with connector ID 'pingOneSSOConnector'. The Client ID of your PingOne Worker application."
220+
default = null
221+
}
222+
215223
// The 'Client Secret' property for the connector named 'PingOne' with connector ID 'pingOneSSOConnector'. The Client Secret of your PingOne Worker application.
216224
variable "davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientSecret" {
217225
type = string
@@ -235,11 +243,3 @@ variable "davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02
235243
description = "The 'Region' property for the connector named 'PingOne' with connector ID 'pingOneSSOConnector'. The region in which your PingOne environment exists."
236244
default = null
237245
}
238-
239-
// The 'Client ID' property for the connector named 'PingOne' with connector ID 'pingOneSSOConnector'. The Client ID of your PingOne Worker application.
240-
variable "davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientId" {
241-
type = string
242-
243-
description = "The 'Client ID' property for the connector named 'PingOne' with connector ID 'pingOneSSOConnector'. The Client ID of your PingOne Worker application."
244-
default = null
245-
}

example/output/davinci_connectors.tf

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@ resource "davinci_connection" "flowconnector__33329a264e268ab31fb19637debf1ea3"
8080

8181
dynamic "property" {
8282
for_each = concat(
83-
// Public Key
84-
var.davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_pemPublicKey != null ? [{
85-
name = "pemPublicKey"
86-
type = "string"
87-
value = jsonencode(var.davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_pemPublicKey)
88-
}] : [],
8983
// Enforce Signed Token
9084
var.davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_enforcedSignedToken != null ? [{
9185
name = "enforcedSignedToken"
@@ -98,6 +92,12 @@ resource "davinci_connection" "flowconnector__33329a264e268ab31fb19637debf1ea3"
9892
type = "string"
9993
value = jsonencode(var.davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_inputSchema)
10094
}] : [],
95+
// Public Key
96+
var.davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_pemPublicKey != null ? [{
97+
name = "pemPublicKey"
98+
type = "string"
99+
value = jsonencode(var.davinci_connection_flowconnector__33329a264e268ab31fb19637debf1ea3_pemPublicKey)
100+
}] : [],
101101

102102
)
103103
content {
@@ -126,12 +126,6 @@ resource "davinci_connection" "httpconnector__867ed4363b2bc21c860085ad2baa817d"
126126

127127
dynamic "property" {
128128
for_each = concat(
129-
// Trusted Sites
130-
var.davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_whiteList != null ? [{
131-
name = "whiteList"
132-
type = "string"
133-
value = jsonencode(var.davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_whiteList)
134-
}] : [],
135129
// Select an OpenID token management connection for signed HTTP responses.
136130
var.davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_connectionId != null ? [{
137131
name = "connectionId"
@@ -150,6 +144,12 @@ resource "davinci_connection" "httpconnector__867ed4363b2bc21c860085ad2baa817d"
150144
type = "string"
151145
value = jsonencode(var.davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_recaptchaSiteKey)
152146
}] : [],
147+
// Trusted Sites
148+
var.davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_whiteList != null ? [{
149+
name = "whiteList"
150+
type = "string"
151+
value = jsonencode(var.davinci_connection_httpconnector__867ed4363b2bc21c860085ad2baa817d_whiteList)
152+
}] : [],
153153

154154
)
155155
content {
@@ -187,6 +187,18 @@ resource "davinci_connection" "notificationsconnector__cacf3d2861657174d93cbf445
187187

188188
dynamic "property" {
189189
for_each = concat(
190+
// Client ID
191+
var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientId != null ? [{
192+
name = "clientId"
193+
type = "string"
194+
value = jsonencode(var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientId)
195+
}] : [],
196+
// Client Secret
197+
var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientSecret != null ? [{
198+
name = "clientSecret"
199+
type = "string"
200+
value = jsonencode(var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientSecret)
201+
}] : [],
190202
// Environment ID
191203
var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_envId != null ? [{
192204
name = "envId"
@@ -205,18 +217,6 @@ resource "davinci_connection" "notificationsconnector__cacf3d2861657174d93cbf445
205217
type = "string"
206218
value = jsonencode(var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_region)
207219
}] : [],
208-
// Client ID
209-
var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientId != null ? [{
210-
name = "clientId"
211-
type = "string"
212-
value = jsonencode(var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientId)
213-
}] : [],
214-
// Client Secret
215-
var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientSecret != null ? [{
216-
name = "clientSecret"
217-
type = "string"
218-
value = jsonencode(var.davinci_connection_notificationsconnector__cacf3d2861657174d93cbf445d55797a_clientSecret)
219-
}] : [],
220220

221221
)
222222
content {
@@ -245,6 +245,12 @@ resource "davinci_connection" "pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9
245245

246246
dynamic "property" {
247247
for_each = concat(
248+
// Client ID
249+
var.davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientId != null ? [{
250+
name = "clientId"
251+
type = "string"
252+
value = jsonencode(var.davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientId)
253+
}] : [],
248254
// Client Secret
249255
var.davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientSecret != null ? [{
250256
name = "clientSecret"
@@ -269,12 +275,6 @@ resource "davinci_connection" "pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9
269275
type = "string"
270276
value = jsonencode(var.davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_region)
271277
}] : [],
272-
// Client ID
273-
var.davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientId != null ? [{
274-
name = "clientId"
275-
type = "string"
276-
value = jsonencode(var.davinci_connection_pingonemfaconnector__b72bd44e6be8180bd5988ac74cd9c949_clientId)
277-
}] : [],
278278

279279
)
280280
content {
@@ -337,6 +337,12 @@ resource "davinci_connection" "pingonessoconnector__94141bf2f1b9b59a5f5365ff135e
337337

338338
dynamic "property" {
339339
for_each = concat(
340+
// Client ID
341+
var.davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientId != null ? [{
342+
name = "clientId"
343+
type = "string"
344+
value = jsonencode(var.davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientId)
345+
}] : [],
340346
// Client Secret
341347
var.davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientSecret != null ? [{
342348
name = "clientSecret"
@@ -355,12 +361,6 @@ resource "davinci_connection" "pingonessoconnector__94141bf2f1b9b59a5f5365ff135e
355361
type = "string"
356362
value = jsonencode(var.davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_region)
357363
}] : [],
358-
// Client ID
359-
var.davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientId != null ? [{
360-
name = "clientId"
361-
type = "string"
362-
value = jsonencode(var.davinci_connection_pingonessoconnector__94141bf2f1b9b59a5f5365ff135e02bb_clientId)
363-
}] : [],
364364

365365
)
366366
content {

internal/generate/data_connection.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package generate
22

33
import (
4+
"slices"
5+
"strings"
6+
47
"github.com/samir-gandhi/davinci-client-go/davinci"
58
)
69

@@ -54,6 +57,10 @@ func getConnectionProperties(connectorID string) ([]connectionDataProperty, erro
5457
}
5558
}
5659

60+
slices.SortFunc(connectionProperties, func(i, j connectionDataProperty) int {
61+
return strings.Compare(i.Name, j.Name)
62+
})
63+
5764
return connectionProperties, nil
5865
}
5966

0 commit comments

Comments
 (0)