-
Notifications
You must be signed in to change notification settings - Fork 128
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 kong2tf
command
#1391
Add kong2tf
command
#1391
Conversation
…ore blocks, plus appropriate switches; patches "route ID is read only field" bug
@Prashansa-K I'm primarily looking for mistakes + potential bugs in this review. I know the code needs a ton of work to be up to standard. I'd like to submit that in a followup as this is a Summit feature. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1391 +/- ##
=======================================
Coverage ? 29.49%
=======================================
Files ? 59
Lines ? 5136
Branches ? 0
=======================================
Hits ? 1515
Misses ? 3512
Partials ? 109 ☔ View full report in Codecov by Sentry. |
@mheap Do we want this command to be in prod before the summit? Or we doing a beta release first? |
kong2tf/builder_default_terraform.go
Outdated
|
||
func (b *DefaultTerraformBuider) buildControlPlaneVar(content *file.Content, generateImportsForControlPlaneID *string, ignoreCredentialChanges bool) { | ||
cpId := "YOUR_CONTROL_PLANE_ID" | ||
if generateImportsForControlPlaneID != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If generateImportsForControlPlaneID
is nil, cpId is left to "YOUR_CONTROL_PLANE_ID". I am assuming that the user is supposed to replace this string with their own CP id in the generated Terraform file. Is that assumption correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct. If they provide generateImportsForControlPlaneID
we populate it for them
@Prashansa-K Before summit - the provider is already available as a beta |
@mheap This looks good to me. The presence of exhaustive tests is giving me more confidence on this. |
Integration test seems like a flake. |
@Prashansa-K @battlebyte Can you work together to fix the lint error and release? |
I am working on fixing the integration test errors here: #1396 PR is in review. For the release, I will add a changelog with this PR: #1395 which is already there for a pending release item. |
@Prashansa-K @mheap PR for the docs here: Kong/docs.konghq.com#7899 |
Adds the
kong2tf
command to convert a deck file to Terraform.If
--generate-imports-for-control-plane-id
is provided,import
blocks will be added to Terraform to adopt existing resources.If
--ignore-credential-changes
is added, any credentials will be ignored until they are destroyed and recreated.Tested with the following deck file which contains one of every entity, including plugin scopes.
Steps to test yourself:
deck
or the UIdeck dump --konnect-token $KONNECT_TOKEN --konnect-control-plane-name "YOUR_CP_NAME" --with-id
deck file kong2tf -s ./kong.yaml --generate-imports-for-control-plane-id "0dea9abf-074a-4988-bdd6-c9ea1ea25d4b" --ignore-credential-changes
terraform plan
. It will show all entities being adopted