terraform-provider-statuspage
terraform-provider-statuspage copied to clipboard
Add group id support to component creation
We have a use-case where component when created has to be added to a component group, the source code of terraform-statuspage-provider does not allow configuration of group id during component creation where the go-sdk already has support for it. The task of this ticket is to update the component creation function to also incorporate group id to fulfil our use-case.
I have already taken a fork of the project, made changes to the source code and would soon create a PR to resolve this issue.
Hi @usmansharifkhan , I am looking into this, but I admit I am a bit confused by the Statuspage API. When creating a component group, you must pass a list of components that are part of that group. There is however also a group_id you can pass when creating a component, which is what you are adding.
When managing both the component_group and the component using terraform, if you don't want a diff with the component_group, you are going to need to add the group_id to the component, but also the component name to the component_group?
Can you expand on your use case and why you can not create the component and add the component to the component_group? Thanks!
Hi @yannh, apologies for replying late, I somehow missed your message on the issue. Yes, you are right, it does add the limitation which I have explained here in extra notes (https://github.com/yannh/terraform-provider-statuspage/pull/43/files)
The usecase came into being from using the existing roll-out strategy we have used for our micro-services within the company to automate the creation of different resources which includes statuspage component where the component group is pre-created manually. And we have been using forked version statuspage terraform provider within our stack for a few months.
Also copying the extra notes here for better visibility where I have tried to explain the reasoning behind the use of DiffSuppressFunc attribute to ignore diffs when the terraform resource of component would try to overwrite the state written by component_group,
Creating `statuspage_component` without `group_id` configured leads to it being highlighted as empty string on the terraform local state whereas configuring the `statuspage_component_group` resource within the IaC can lead to the remote state being changed, this in turn leads to a difference in terraform plan.
For `group_id` parameter in `statuspage_component`, `DiffSuppressFunc` has been added to ignore terraform plan diff when new `group_id` is expected to be an empty string.
This chicken and egg problem can happen for the `statuspage_component_group` terraform resource as well, so in that case `group_id` should be only set on the `statuspage_component` resource when `statuspage_component_group` is not included within IaC.