Skip to content

Add entity details data source - #99

Merged
keithfz merged 7 commits into
cortexapps:mainfrom
TomWKraken:add-entity-details-data-source
Apr 14, 2026
Merged

Add entity details data source#99
keithfz merged 7 commits into
cortexapps:mainfrom
TomWKraken:add-entity-details-data-source

Conversation

@TomWKraken

@TomWKraken TomWKraken commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Add Full Entity Details to cortex_catalog_entity Data Source

Description

Enhances the cortex_catalog_entity data source to expose comprehensive catalog entity information by switching from the entity descriptor endpoint to the full entity details endpoint.

Changes

  • Updates data source to use GET /api/v1/catalog/{tagOrId} instead of /api/v1/catalog/{tagOrId}/openapi
  • Expands schema to expose:
    • Ownership information (emails and groups with inheritance details)
    • Slack channel associations
    • Git repository information
    • Archive status and last updated timestamp
    • Links and custom metadata
    • Additional entity identifiers (ID, tag)

Motivation

Previously, the data source only exposed basic metadata (tag, name, description). Users had no way to query entity ownership, integrations, or other critical attributes through Terraform. This enhancement enables richer entity queries and allows teams to programmatically access entity details for automation, reporting, and validation use cases.

Example Usage:

data "cortex_catalog_entity" "my_service" {
  tag = "my-service"
}

output "service_owner" {
  value = data.cortex_catalog_entity.my_service.ownership.groups[0].group_name
}

output "service_git_repo" {
  value = data.cortex_catalog_entity.my_service.git.repository
}

Breaking Changes

None. This is purely additive—all existing configurations continue to work as before. Core fields (tag, name, description) remain unchanged.

Testing

  • Verified data source returns all entity details from the API
  • Tested nested object and list attribute access
  • Confirmed existing tests pass
  • Data source successfully builds and integrates with provider

Notes

  • Internal Go struct CatalogEntity.Title renamed to Name to match API response field names
  • Internal Slack integration type renamed from CatalogEntitySlackChannel to CatalogEntitySlackIntegrationChannel to avoid collision with new entity response type

Comment thread internal/provider/catalog_entity_data_source.go Outdated
Comment thread internal/provider/catalog_entity_data_source.go Outdated
Comment thread internal/provider/catalog_entity_data_source.go

@keithfz keithfz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overall looks good, thank you!

Minor lint fixes for CI, also might be good to have some additional unit tests around the FromApiModel changes. E.g. happy path, empty/nil collections, etc.

@TomWKraken
TomWKraken force-pushed the add-entity-details-data-source branch from 2c8f3f0 to a9be39d Compare April 13, 2026 14:15
@TomWKraken
TomWKraken requested a review from keithfz April 13, 2026 14:56
@TomWKraken

Copy link
Copy Markdown
Contributor Author

Overall looks good, thank you!

Minor lint fixes for CI, also might be good to have some additional unit tests around the FromApiModel changes. E.g. happy path, empty/nil collections, etc.

Actioned comments and added unit tests for the API model 🙇

@keithfz

keithfz commented Apr 13, 2026

Copy link
Copy Markdown

awesome! i think we just need a go generate ./... for some code gen and then it's good to go!

https://github.com/cortexapps/terraform-provider-cortex/actions/runs/24350286252/job/71116206010?pr=99

@TomWKraken

Copy link
Copy Markdown
Contributor Author

awesome! i think we just need a go generate ./... for some code gen and then it's good to go!

https://github.com/cortexapps/terraform-provider-cortex/actions/runs/24350286252/job/71116206010?pr=99

Awesome that's done @keithfz - thanks for the reviews

@TomWKraken
TomWKraken force-pushed the add-entity-details-data-source branch from dd919ee to 4b98967 Compare April 14, 2026 14:19
@keithfz
keithfz merged commit 8e3ebb9 into cortexapps:main Apr 14, 2026
3 checks 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.

2 participants