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

Commit 5f3966a

Browse files
authored
Merge pull request #18 from patrickcping/enforce-connector-property-ordering-for-idempotent-generation-202412
Enforce connector property ordering for idempotent generation
2 parents 259eccb + bde7ea7 commit 5f3966a

4 files changed

Lines changed: 163 additions & 79 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '34 8 * * 5'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
- name: Install Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version-file: go.mod
47+
48+
# Initializes the CodeQL tools for scanning.
49+
- name: Initialize CodeQL
50+
uses: github/codeql-action/init@v3
51+
with:
52+
languages: ${{ matrix.language }}
53+
# If you wish to specify custom queries, you can do so here or in a config file.
54+
# By default, queries listed here will override any specified in a config file.
55+
# Prefix the list here with "+" to use these queries and those in the config file.
56+
57+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
58+
# queries: security-extended,security-and-quality
59+
60+
61+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
62+
# If this step fails, then you should remove it and run the build manually (see below)
63+
- name: Autobuild
64+
uses: github/codeql-action/autobuild@v3
65+
66+
# ℹ️ Command-line programs to run using the OS shell.
67+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
68+
69+
# If the Autobuild fails above, remove it and uncomment the following three lines.
70+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
71+
72+
# - run: |
73+
# echo "Run, Build Application using script"
74+
# ./location_of_script_within_repo/buildscript.sh
75+
76+
- name: Perform CodeQL Analysis
77+
uses: github/codeql-action/analyze@v3

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)