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

[ORCA-5140] Add support for Event Orchestration External Data Cache Variables #984

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alenapan
Copy link
Contributor

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 image
  • website/docs/d/event_orchestration_service_cache_variable.html.markdown image
  • website/docs/r/event_orchestration_global_cache_variable.html.markdown image
  • website/docs/r/event_orchestration_service_cache_variable.html.markdown image

@alenapan alenapan changed the title Orca 5140 eo external data cache var [ORCA-5140] Add support for Event Orchestration External Data Cache Variables Feb 20, 2025
@@ -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
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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,
Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is nice 👏

Copy link
Contributor

@tyurina tyurina left a 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!

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.

2 participants