[FUNK-1866] - Source insert function handling with terraform #192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA Ticket
FUNK-1866
Description
This PR improves the handling of the display_name attribute for Segment Functions of type INSERT_SOURCE, INSERT_DESTINATION, and DESTINATION in the Terraform provider. Specifically, it ensures that the display_name in Terraform state remains consistent with the value provided in the configuration, avoiding unwanted workspace name suffixes that Segment may append for these resource types.
Changes
Ensures display_name is set from the plan for INSERT_SOURCE, INSERT_DESTINATION, and DESTINATION types after create and update.
Maintains the configured display_name in the Terraform state for these types during read operations.
No changes to the provider schema or breaking changes for users.
Made changes for newly added INSERT_SOURCE tests too in _test.go
Motivation
Segment appends the workspace name to the display name for certain function types, which can cause drift between the Terraform configuration and the actual state. This change keeps the Terraform state consistent and avoids unnecessary diffs.
Testing
Acceptance tests for INSERT_SOURCE and other function types pass.


Manual testing with real Segment API confirms correct behavior.