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

feat(policies): support storage policies within terraform #558

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

kheina
Copy link
Contributor

@kheina kheina commented Feb 6, 2024

NOTE: requires hashicorp/boundary#4385 to be merged and tagged and go.mod updated before merging and deploying

testing was done manually due to policies being an enterprise feature

Copy link
Contributor

@louisruch louisruch left a comment

Choose a reason for hiding this comment

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

You will need to run make docs locally, otherwise left a couple of inline comments, some of them should remove a number of subtype checks performed here.

internal/provider/resource_policy.go Outdated Show resolved Hide resolved
internal/provider/resource_policy.go Outdated Show resolved Hide resolved
internal/provider/resource_policy.go Outdated Show resolved Hide resolved
internal/provider/resource_policy.go Outdated Show resolved Hide resolved
internal/provider/resource_policy.go Outdated Show resolved Hide resolved
internal/provider/resource_policy_attachment.go Outdated Show resolved Hide resolved
Comment on lines 71 to 79
var policy_type string
switch {
case strings.HasPrefix(policyId, policyStoragePolicyPrefix):
if _, err := scp.AttachStoragePolicy(ctx, scopeId, 0, policyId, opts...); err != nil {
return diag.FromErr(err)
}
policy_type = "storage"
default:
return diag.Errorf("unknown policy type provided.")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure we need the check here, but this should only ever support storage policy types so if you really want a check you can just do the if strings.HasPrefix, though if you are doing this check you should check that the scopeId is global or that of an org scope only as well

internal/provider/resource_policy_attachment.go Outdated Show resolved Hide resolved
internal/provider/resource_policy_attachment.go Outdated Show resolved Hide resolved
internal/provider/resource_policy_attachment.go Outdated Show resolved Hide resolved
@kheina kheina force-pushed the dmiu_storage-policies branch 3 times, most recently from 987270b to 4e86cae Compare February 6, 2024 18:34
@kheina kheina requested a review from louisruch February 6, 2024 18:36
Copy link
Contributor

@louisruch louisruch left a comment

Choose a reason for hiding this comment

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

One new comment and responded to the one thread re subtype agnostic attachments. Regardless on the final approach there we should add scope to the resource so resource_scope_policy_attachment or resource_scope_policy_storage_attachment

internal/provider/resource_policy_storage.go Outdated Show resolved Hide resolved
internal/provider/resource_policy_attachment.go Outdated Show resolved Hide resolved
@kheina kheina force-pushed the dmiu_storage-policies branch 3 times, most recently from 58a9855 to de1f0ce Compare February 12, 2024 21:34
@kheina kheina requested a review from louisruch February 12, 2024 21:35
@kheina kheina force-pushed the dmiu_storage-policies branch from de1f0ce to 793fa38 Compare February 12, 2024 21:44
Copy link
Contributor

@louisruch louisruch left a comment

Choose a reason for hiding this comment

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

This looks great! :shipit:

@psekar psekar added this to the 0.15.x milestone Feb 13, 2024
@kheina kheina force-pushed the dmiu_storage-policies branch from 793fa38 to 4e69d50 Compare February 13, 2024 20:21
@kheina kheina changed the title feat(policy): support storage policies within terraform feat(policies): support storage policies within terraform Feb 13, 2024
@psekar psekar merged commit 7e7707d into main Feb 14, 2024
6 checks passed
@psekar psekar deleted the dmiu_storage-policies branch February 14, 2024 00:22
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.

4 participants