-
Notifications
You must be signed in to change notification settings - Fork 392
[datadog_compliance_custom_framework] Terraform Provider for Custom Frameworks #2975
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
base: master
Are you sure you want to change the base?
Conversation
ccaf302
to
f8a90fe
Compare
ac03605
to
e2e496e
Compare
examples/resources/datadog_compliance_custom_framework/resource.tf
Outdated
Show resolved
Hide resolved
apiReqMap := make(map[string]datadogV2.CustomFrameworkRequirement) | ||
apiCtrlMap := make(map[string]map[string]datadogV2.CustomFrameworkControl) | ||
|
||
for _, req := range data.GetData().Attributes.Requirements { |
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.
NIT: this is very hard to read in github, could we extract some of the inner loops to their own methods so its more digestible? It also would make it easier to read in the editor
return v.Description(ctx) | ||
} | ||
|
||
func (v requirementNameValidator) ValidateList(ctx context.Context, req validator.ListRequest, resp *validator.ListResponse) { |
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.
Is there a specific reason why we need two validators? the code looks pretty similar between these two (I am probably missing something)
Motivation:
We wanted a terraform provider to interact with our Custom Framework APIs. The terraform resources will remain as the source of truth so whenever a resource is updated/created/deleted this will be reflected in the database and UI.
Testing
I built the Terrraform provider locally.
Tested the following:
Creating

Updating

Deleting/Destroying

Changing order of rules

no changes in state so no action taken
Terraform Provider Immutable Fields (Handle And Version)

Testing Large Input
Created this Framework: https://dd.datad0g.com/security/compliance/home/custom/my-custom-framework-terraform-3/3.0.0?previousUrl=%2Fsecurity%2Fcompliance%2Fhome×tamp=1747948011353&live=true
one control with over 200 rule ids (seconds to complete)
Commands:
also added unit tests!