Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add konnect_gateway_config_store resource #117

Merged
merged 6 commits into from
Feb 10, 2025

Conversation

mheap
Copy link
Member

@mheap mheap commented Jan 30, 2025

Ready for review

@mheap mheap requested a review from harshadixit12 January 30, 2025 20:06
@mheap mheap marked this pull request as draft January 30, 2025 20:07
@@ -0,0 +1,15 @@
resource "konnect_gateway_config_store" "my_configstore" {
name = "Config Store"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name for config store does not allow space - getting an error which goes away when space is removed.
{"code":3,"message":"validation │ error","details":[{"@type":"type.googleapis.com/kong.admin.model.v1.ErrorDetail","type":"ERROR_TYPE_FIELD","field":"name","messages":["must │ match pattern '^[\\p{N}\\p{L}.\\-_~]*$'"]}]}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I’ll update the example

resource "konnect_gateway_vault" "my_vault" {
name = "konnect"
prefix = "my-konnect-vault"
config = jsonencode({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the openAPI spec, config is expected to be an object, why do we encode it as string here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terraform expects to deal with explicit schemas. Vaults are polymorphic and the config is different for every vault type.

We had two options here:

  1. Create one resource per vault type
  2. Use a single resource with a dynamic schema and the x-speakeasy-type-override: any annotation

We chose option two. This makes the provider accept a string, which is then deserialized in to an any type before being sent to the API.

This decision predates this PR and is in use for every other vault type too.

@mheap mheap force-pushed the add-config-store branch 2 times, most recently from 5210819 to f94d435 Compare February 6, 2025 20:04
@mheap mheap marked this pull request as ready for review February 6, 2025 20:09
@mheap mheap requested a review from harshadixit12 February 6, 2025 20:09
@harshadixit12 harshadixit12 merged commit f977afe into release/2.3.0 Feb 10, 2025
1 check passed
@mheap mheap deleted the add-config-store branch February 10, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants