-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[v18] tfgen: support including top-level access list scope field #69614
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
Open
kimlisa
wants to merge
1
commit into
branch/v18
Choose a base branch
from
bot/backport-69337-branch/v18
base: branch/v18
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
lib/tfgen/testdata/TestGenerate_AccessListMemberWithScope.golden
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| resource "teleport_access_list_member" "some-member" { | ||
| scope = "/some/member-scope" | ||
| header = { | ||
| kind = "access_list_member" | ||
| version = "v1" | ||
| metadata = { | ||
| name = "some-member" | ||
| } | ||
| } | ||
|
|
||
| spec = { | ||
| access_list = "some-id" | ||
| name = "some-member" | ||
| reason = "some reason" | ||
| added_by = "admin" | ||
| ineligible_status = "0" | ||
| membership_kind = "1" | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
lib/tfgen/testdata/TestGenerate_AccessListWithScope.golden
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| resource "teleport_access_list" "some-access-list" { | ||
| scope = "/some/scope" | ||
| header = { | ||
| kind = "access_list" | ||
| version = "v1" | ||
| metadata = { | ||
| name = "some-access-list" | ||
| } | ||
| } | ||
|
|
||
| spec = { | ||
| description = "An example scoped access list" | ||
| owners = [{ | ||
| description = "some description" | ||
| ineligible_status = "0" | ||
| membership_kind = "1" | ||
| name = "llama" | ||
| }] | ||
| audit = { | ||
| next_audit_date = "2023-02-02T00:00:00Z" | ||
| recurrence = { | ||
| frequency = "3" | ||
| day_of_month = "1" | ||
| } | ||
| notifications = { | ||
| start = "336h0m0s" | ||
| } | ||
| } | ||
| title = "My Access List" | ||
| } | ||
| } |
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
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
Oops, something went wrong.
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.
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.
When
tfgenis given a scopedaccess_list_memberwhoseSpec.AccessListis a bare list name (the new test constructs this exact case), this line emitsscope, but the generated HCL still leavesspec.access_listbare. The access-list service treats any non-empty member scope as requiringspec.access_listto be scope-qualified (ParentListOfinlib/accesslists/scopequalifiedname.go:142-149callsParseScopeQualifiedName), so Terraform apply fails before creating the member; either qualify the parent (/scope::name) when emitting scoped members or reject/normalize this input.Useful? React with 👍 / 👎.