fix(platform_lifecycle): allow "_global_" special import id for global lifecycle import - #337
Open
kingcrunch wants to merge 1 commit into
Open
Conversation
…l lifecycle import
Terraform CLI rejects empty import IDs in declarative import{} blocks.
The global lifecycle was documented to be imported with an empty string,
which fails during Terraform plan/apply.
Use "_global_" instead of "global" as the special import id because
"global" is a syntactically valid project_key (^[a-z][a-z0-9\\-]{1,31}$)
and would shadow a real project named "global". "_global_" is not a valid
project key and is therefore unambiguous.
Fixes jfrog#331
Assisted-by: opencode:kimi-k2.7-code
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Collaborator
|
Hi @kingcrunch , Thank you for your contribution. Our CI pipeline issues have been resolved, and we are now accepting contributions again. If you are still interested in submitting this change, please rebase your branch on master and update the CHANGELOG. We look forward to reviewing your pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(platform_lifecycle): allow "global" special import id for global lifecycle import
Summary
Terraform CLI rejects empty import IDs in declarative
import{}blocks. Theplatform_lifecycleresource documented importing the global lifecycle with an empty string (terraform import platform_lifecycle.global ""/id = ""), which now fails with:This PR fixes the issue by accepting the non-empty special import id
"_global_"for the global lifecycle while continuing to use the actualproject_keyfor project-scoped lifecycles.We deliberately chose
"_global_"over"global"because project keys in the JFrog platform must match^[a-z][a-z0-9\-]{1,31}$. A plain"global"special import id would therefore shadow a real project namedglobaland make it impossible to import that project's lifecycle."_global_"is not a valid project key, so it is unambiguous.Fixes #331
Changes
pkg/platform/resource_lifecycle.goImportStateso that"_global_"is treated as the global lifecycle (noproject_keyset), alongside the existing empty-string handling for backward compatibility with the legacy CLI import.docs/resources/lifecycle.mdandexamples/resources/platform_lifecycle/import.sh"_global_"instead of"".CHANGELOG.mdHow to verify
make testJFROG_URL+JFROG_ACCESS_TOKENset, import the global lifecycle via animport{}block:Checklist
go fmtgo build ./...)make test)make acceptance)I have read the CLA Document and I hereby sign the CLA.
Notes
This merge request was prepared with assistance from AI (opencode:kimi-k2.7-code). I have reviewed and understood the changes and take responsibility for them.