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

[CSGINS-1453] Add incident types resources #962

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

cjgajard
Copy link
Contributor

@cjgajard cjgajard commented Jan 7, 2025

  • data pagerduty_incident_type
  • data pagerduty_incident_type_custom_field
  • resource pagerduty_incident_type
  • resource pagerduty_incident_type_custom_field

* data pagerduty_incident_type
* data pagerduty_incident_type_custom_field
* resource pagerduty_incident_type
* resource pagerduty_incident_type_custom_field
website/docs/r/incident_type.html.markdown Outdated Show resolved Hide resolved
website/docs/r/incident_type.html.markdown Outdated Show resolved Hide resolved
website/docs/r/incident_type.html.markdown Outdated Show resolved Hide resolved
website/docs/r/incident_type_custom_field.html.markdown Outdated Show resolved Hide resolved
Copy link

@akosasante akosasante left a comment

Choose a reason for hiding this comment

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

Tested:

  • able to create an incident type (though left a comment, seems like it creates it disabled by default)
  • able to update an incident type
  • able to disable an incident type
  • able to import an existing type
  • unable to delete a type (as expected; and a warning is printed)
  • able to use data block to refer to an existing type by Display Name
  • able to create a field under a given type
  • able to update a field
  • able to disable a field
  • able to delete a field
  • able to import an existing field
  • able to refer to an existing field with data block
  • able to handle expected errors/validation errors and print (with the caveat that for some validation errors, it fails to print because we haven't yet fixed the nested errors on our end: https://pagerduty.atlassian.net/browse/INCIDENTS-2186)

website/docs/r/incident_type.html.markdown Show resolved Hide resolved
* `field_type` - (Required) [Updating causes resource replacement] The field type of the field. Must be one of `single_value`, `single_value_fixed`, `multi_value`, or `multi_value_fixed`.
* `description` - The description of the custom field.
* `default_value` - The default value to set when new incidents are created. Always specified as a string.
* `enabled` - Whether the custom field is enabled.

Choose a reason for hiding this comment

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

Should we note that it defaults to enabled if this property is not pssed in?

Choose a reason for hiding this comment

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

Since there's no incident_custom_field_option resource, that means we can't update the name of a field option in-place, we can only replace (delete+create) field options, here with the incident_type_custom_field resource, am I understanding correctly?

Or would I be expected to use https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/resources/incident_custom_field_option with this? I think that doesn't work currently since that resource is not expecting the compound id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I opted into not implementing a incident_type_custom_field_option resource nor datasource because they don't have a name, hence they can't be searched by anything other than value (or ID).

Also, the requirement for a field_options in *_fixed fields made it difficult to use with an option resource.
If you create field_options = ["a", "b"] and then create a resource "incident_type_custom_field_option" "c" { value = "c" } it would break its parent definition.

Now they're accesible through their parent field field_options.

Choose a reason for hiding this comment

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

:ack: Okay, that makes sense 👍

@cjgajard cjgajard marked this pull request as ready for review January 10, 2025 13:49
Copy link

@akosasante akosasante left a comment

Choose a reason for hiding this comment

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

Re-tested and incident type was created in enabled mode when that property is not provided now 👍 ✅

All feedback has been addressed. Functionality-wise LGTM! (I'm not super familiar with golang so I can't speak to that end of things but it all works :D)

@imjaroiswebdev imjaroiswebdev changed the title Add incident types resources [CSGINS-1453] Add incident types resources Jan 10, 2025
go.mod Outdated Show resolved Hide resolved
@cjgajard cjgajard merged commit e751e11 into PagerDuty:master Jan 13, 2025
1 check passed
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.

3 participants