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

GPE-14846: Add External Sources resource #1450

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

michalk-genesys
Copy link
Contributor

Adding External Sources resource to manage resources with /api/v2/externalcontacts/externalsources API


### Optional

- `active` (Boolean) Whether the external source is active. Defaults to `true`.
Copy link
Contributor Author

@michalk-genesys michalk-genesys Jan 6, 2025

Choose a reason for hiding this comment

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

When creating new External Sources, the backing API will ignore the value from the request and always create resource with active set to true.
I thought I'd call this out, in case this is a problem for TF provider or our users.

When running the provider locally with added trace logging, we can see this message:
2025-01-06T12:15:59.181Z [WARN] Provider "provider["genesys.com/mypurecloud/genesyscloud"]" produced an unexpected new value for genesyscloud_externalcontacts_external_source.inactive_external_source, but we are tolerating it because it is using the legacy plugin SDK.
The following problems may be the cause of any confusing errors from downstream operations:
- .active: was cty.False, but now cty.True

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A change is being proposed to address this in the backend, so that the active value from the request is honoured.


Optional:

- `uri_template` (String)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This string allows templating, with {{}}. The only value supported for now is {{externalId.value}}. Should this be called out in the field description?
This is not mentioned in Public API docs.


cursor := ""
for {
externalSources, resp, err := p.externalContactsApi.GetExternalcontactsExternalsources(cursor, 100, query, true) // workaround for active being a required arg on Platform Client SDK Go GetExternalcontactsExternalsources
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left a comment in the code to make this more visible. The method in our SDK requires passing active as an arg and this is not optional, so I ended up making two requests: first one for all active:true and the second for all active:false.

)

// getAllAuthExternalContactsExternalSources retrieves all of the external sources via Terraform in the Genesys Cloud and is used for the exporter
func getAllAuthExternalContactsExternalSources(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is similar resource to External Organizations and can have same problem as the one dealt with in DEVTOOLING-977.
The API can return more than 1000 resources, as there is no upper limit on how many External Sources we can have in total. The limit is only applied on the number of active ones.

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.

1 participant