Adding changes to support tfpolicy_evaluations#1313
Adding changes to support tfpolicy_evaluations#1313subhro-acharjee-1 wants to merge 19 commits intomainfrom
Conversation
Co-authored-by: Copilot <copilot@github.com>
…65-adding-support-for-tfpolicy-evaluations-outcome
Co-authored-by: Copilot <copilot@github.com>
shrishyamb
left a comment
There was a problem hiding this comment.
Added comments. In general please check the openapi spec for the Run, TFPolicyEvaluation and TFPolicySetOutcome API's for the updated fields.
| ) | ||
|
|
||
| type TFPolicyEvaluationStatusTimestamps struct { | ||
| CanceledAt time.Time `jsonapi:"attr,canceled-at,rfc3339"` |
There was a problem hiding this comment.
Refer spec for the status timestamp fields.
…evaluations-outcome
ctrombley
left a comment
There was a problem hiding this comment.
@subhro-acharjee-1, would you please address the comments I left here?
|
|
||
| type TFPolicyEvaluationResultCount struct { | ||
| AdvisoryFailed int `jsonapi:"attr,advisory-failed"` | ||
| MadatoryFailed int `jsonapi:"attr,mandatory-failed"` |
There was a problem hiding this comment.
nit:
| MadatoryFailed int `jsonapi:"attr,mandatory-failed"` | |
| MandatoryFailed int `jsonapi:"attr,mandatory-failed"` |
|
|
||
| const ( | ||
| TFPolicyEvaluationErrorTypeSetupError TFPolicyEvaluationErrorType = "setup_error" | ||
| TFPolicyEvaluationErrorTypeIncompaitbleAgentVersion TFPolicyEvaluationErrorType = "incompatible_agent_version" |
There was a problem hiding this comment.
nit:
| TFPolicyEvaluationErrorTypeIncompaitbleAgentVersion TFPolicyEvaluationErrorType = "incompatible_agent_version" | |
| TFPolicyEvaluationErrorTypeIncompatbleAgentVersion TFPolicyEvaluationErrorType = "incompatible_agent_version" |
| AwaitingOverrideAt time.Time `jsonapi:"attr,awaiting-override-at,rfc3339"` | ||
| PassedAt time.Time `jsonapi:"attr,passed-at,rfc3339"` | ||
| FailedAt time.Time `jsonapi:"attr,failed-at,rfc3339"` | ||
| OverridenAt time.Time `jsonapi:"attr,overridden-at,rfc3339"` |
There was a problem hiding this comment.
nit:
| OverridenAt time.Time `jsonapi:"attr,overridden-at,rfc3339"` | |
| OverriddenAt time.Time `jsonapi:"attr,overridden-at,rfc3339"` |
| type TFPolicyEvaluationOutcomeEnforcementLevel string | ||
|
|
||
| const ( | ||
| TFPolicyEvaluationOutcomeEnforcementLevelAdvisory TFPolicyEvaluationOutcomeEnforcementLevel = "advisory" | ||
| TFPolicyEvaluationOutcomeEnforcementLevelMandatory TFPolicyEvaluationOutcomeEnforcementLevel = "mandatory" | ||
| TFPolicyEvaluationOutcomeEnforcementLevelMandatoryOverridable TFPolicyEvaluationOutcomeEnforcementLevel = "mandatory_overridable" | ||
| ) | ||
|
|
||
| type TFPolicyEvaluationOutcomeStatus string | ||
|
|
||
| const ( | ||
| TFPolicyEvaluationOutcomeStatusPassed TFPolicyEvaluationOutcomeStatus = "passed" | ||
| TFPolicyEvaluationOutcomeStatusFailed TFPolicyEvaluationOutcomeStatus = "failed" | ||
| TFPolicyEvaluationOutcomeStatusErrored TFPolicyEvaluationOutcomeStatus = "errored" | ||
| TFPolicyEvaluationOutcomeStatusUnknown TFPolicyEvaluationOutcomeStatus = "unknown" | ||
| ) |
There was a problem hiding this comment.
Are these in use anywhere? If not, can we remove them?
There was a problem hiding this comment.
TFPolicyEvaluationOutcomeEnforcementLevel is getting used in Outcome struct so cant remove it but i am removing the TFPolicyEvaluationOutcomeStatus
| ) | ||
|
|
||
| // NOTE: TFpolicy is still a beta feature and is subject to change. | ||
|
|
There was a problem hiding this comment.
Suggestion for consistency with other services in this repo:
| // Compile-time proof of interface implementation. | |
| var _ TFPolicyEvaluationOutcomes = (*tfPolicyEvaluationOutcomes)(nil) | |
| if err := options.valid(); err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
Consider removing this check and the called valid() method if it's just a no-op.
| func (s *TFPolicyEvaluationListOptions) valid() error { | ||
| return nil | ||
| } |
…lan subscription (#1317) * Update helper_test.go * Update CHANGELOG.md * print agent output upon failure * fix test * take out log * Update CHANGELOG.md
* adds admin scim groups resouce and integration test * fixed lint * updated changelog entry * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * updated changelog entry * addressed review comment * updated test cases names * updated integration test * added nil receiver guard in valid() fn * added page validation to pass lint * removed redundant test cases * use defaultPageSize const for pagination test * updated test case name --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ons (#1322) The no-code module workspace creation API accepts a terraform-version attribute, but the Go client struct was missing the field, making it impossible to specify a Terraform version at creation time. Add the field with an accurate doc comment (the fallback is the platform's latest available Terraform version, not an org-level default) and a corresponding integration test subcase that verifies the value roundtrips correctly through the API.
…-outcome' of github.com:hashicorp/go-tfe into subhro/TF-34065-adding-support-for-tfpolicy-evaluations-outcome
…evaluations-outcome
Co-authored-by: Chris Trombley <ctrombley@gmail.com>
Description
API endpoints related to tf-policy results needs to be implemented in go-tfe, so that terraform can read the structured response, and then use the information for displaying in the console output.
Testing plan
run.Readwith include options for TFPolicyEvaluationstfEvaluationOutcomes.ListExternal links
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.
Rollback Plan
Changes to Security Controls