-
Notifications
You must be signed in to change notification settings - Fork 216
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
[ORCA-5140] Add support for Event Orchestration External Data Cache Variables #984
base: master
Are you sure you want to change the base?
[ORCA-5140] Add support for Event Orchestration External Data Cache Variables #984
Conversation
@@ -76,3 +76,5 @@ require ( | |||
google.golang.org/protobuf v1.33.0 // indirect | |||
gopkg.in/ini.v1 v1.67.0 // indirect | |||
) | |||
|
|||
replace github.com/heimweh/go-pagerduty => github.com/alenapan/go-pagerduty v0.0.0-20250214201653-b8d11443fbc3 |
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.
Annotation: As always, we'll repoint to the correct version of go-pagerduty
once https://github.com/heimweh/go-pagerduty/pull/159/files is merged before merging this branch into master.
"ttl_seconds": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
}, | ||
} | ||
|
||
func checkConfiguration(context context.Context, diff *schema.ResourceDiff, i interface{}) error { | ||
func checkEventOrchestrationCacheVariableConfiguration(context context.Context, diff *schema.ResourceDiff, i interface{}) error { |
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.
Annotation: With the addition of the third cache var type I decided to rewrite the validation logic a bit to display a list of required and unsupported attributes for each type. If at least one required attribute is missing, the user will see an error message listing all required attributes for the given type. Same goes for unsupported attributes - the user will se the whole list of unsupported attributes in the error message if at least one such attribute is given.
Error messages are tested in the acceptance tests below.
@@ -16,7 +16,7 @@ func resourcePagerDutyEventOrchestrationGlobalCacheVariable() *schema.Resource { | |||
Importer: &schema.ResourceImporter{ | |||
StateContext: resourcePagerDutyEventOrchestrationGlobalCacheVariableImport, | |||
}, | |||
CustomizeDiff: checkConfiguration, | |||
CustomizeDiff: checkEventOrchestrationCacheVariableConfiguration, |
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.
Annotation: the checkConfiguration
function is available to all modules in the provider so I made the name more specific to avoid confusion.
} | ||
return nil | ||
} | ||
|
||
func formatErrors(errors []string) string { |
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.
This is nice 👏
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.
These changes look good to me, thanks for adding the additional configuration validation for each type!
Changes
This PR adds support for the
external_data
cache variable type to the following resources and data sources:pagerduty/resource_pagerduty_event_orchestration_global_cache_variable.go
pagerduty/resource_pagerduty_event_orchestration_service_cache_variable.go
pagerduty/data_source_pagerduty_event_orchestration_global_cache_variable.go
pagerduty/data_source_pagerduty_event_orchestration_service_cache_variable.go
It also extends the documentation for Cache Variable resources and data sources to reflect the new type.
Testing
Provider Changes
Documentation Updates
Used the Doc Preview Tool to test the documentation updates
website/docs/d/event_orchestration_global_cache_variable.html.markdown
website/docs/d/event_orchestration_service_cache_variable.html.markdown
website/docs/r/event_orchestration_global_cache_variable.html.markdown
website/docs/r/event_orchestration_service_cache_variable.html.markdown