Closed brandocomando closed 1 month ago
Thanks for the feedback!
I have often been a bit reluctant in providing resources/datasources that search by name, especially when names uniqueness is not enforced in dbt Cloud, but this approach of "returning all" could work.
We could indeed create a dbtcloud_environments
datasource returning a list of environment_id
and project_id
(and why not environment_name
at the same time if it is available in the same API call) and then let the logic happen in the Terraform config, leveraging the existing dbtcloud_environment
and dbtcloud_project
.
It is then up to the person using those to have safeguards in place if/when multiple environments exist with the same name.
I will be off for a few days but can look at tackling this when I am back.
Part of 0.3.4 being published now and that should be available in the registry in a few minutes
Currently, there isn't a way to get an environment ID from its name. The existing environment data source requires an environment ID and project ID.
It would be nice if we could have new data sources which return a list of ID's for both projects and environments. similar to how the AWS terraform provider handles vpcs. there is a data resource for VPCS and VPC. VPCS returns a list of IDs and VPC takes the ID as the input and returns details about the VPC. A similar approach could be used here for both projects and environments.
with these 2 resources, we can build maps from name to IDS for both and should be able to lookups allowing my module consumers to reference projects and environments by name.