Make kong2tf plugin aware#1979
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1979 +/- ##
==========================================
+ Coverage 32.77% 32.87% +0.10%
==========================================
Files 77 77
Lines 7046 7064 +18
==========================================
+ Hits 2309 2322 +13
- Misses 4543 4546 +3
- Partials 194 196 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5ee2fb5 to
bd242dc
Compare
bd242dc to
d21287a
Compare
d21287a to
31d9863
Compare
| delete(entity, "name") | ||
| // If `name` is not in availablePlugins, then it's a custom plugin and | ||
| // we should use the plugin name as the resource name | ||
| if !contains(availablePlugins, entity["name"].(string)) { |
There was a problem hiding this comment.
When a new plugin is introduced in a new kong gateway version - wouldn't the previously released versions of deck treat it as custom plugin
There was a problem hiding this comment.
Yes, that's correct. That's the tradeoff we're making (it would still work, just without schema checks in TF)
| if customizations == nil { | ||
| customizations = map[string]string{} | ||
| } | ||
| customizations["config"] = "jsonencode" |
There was a problem hiding this comment.
When we do jsonencode - underlying value of config is a string in https://github.com/Kong/terraform-provider-konnect/blob/main/src/custom_plugin_model.go#L40 - config.String() returns string wrapped in additonal characters, which breaks unmarshal. (ex: output is "\"{\\\"hello\\\":\\\"world\\\"}\"" instead of "{\"hello\":\"world\"}")
We'll need to fix this in custom_plugin_model.go (i'll do it)
I don't think we need to block this PR though.
Automatically generate a
konnect_gateway_custom_plugininstance if the provided plugin is not in the list of bundled plugins.You can update the bundled plugins by running
make generate-plugin-listwhile running a Gateway locally.