From be0e79156d2e0e836d211ac0e4e0cb8f3c2a934b Mon Sep 17 00:00:00 2001 From: Alfonso Campodonico Date: Mon, 14 Aug 2023 15:22:42 -0300 Subject: [PATCH] Add UUID to space data source (#378) * Add UUID so it fetches the Space.ID * Update docs --------- Co-authored-by: Mars Hall --- docs/data-sources/space.md | 5 +++-- heroku/data_source_heroku_space.go | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/data-sources/space.md b/docs/data-sources/space.md index c3aad684..c82ad41f 100644 --- a/docs/data-sources/space.md +++ b/docs/data-sources/space.md @@ -29,8 +29,9 @@ The following arguments are supported: The following attributes are exported: -* `name` - The name of the Heroku Private Space. In Heroku, this is also the unique . -* `id` - The unique ID of the Heroku Private Space. +* `name` - The name of the Heroku Private Space. +* `id` - The space's name. (Heroku API supports using name and ID interchangeably, and this data source uses name for the resource ID.) +* `uuid` - The space's unique ID. * `region` - The region in which the Heroku Private Space is deployed. * `state` - The state of the Heroku Private Space. Either `allocating` or `allocated`. * `shield` - Whether or not the space has [Shield](https://devcenter.heroku.com/articles/private-spaces#shield-private-spaces) turned on. One of `on` or `off`. diff --git a/heroku/data_source_heroku_space.go b/heroku/data_source_heroku_space.go index d7806b59..86edfcb6 100644 --- a/heroku/data_source_heroku_space.go +++ b/heroku/data_source_heroku_space.go @@ -18,6 +18,11 @@ func dataSourceHerokuSpace() *schema.Resource { Computed: true, }, + "uuid": { + Type: schema.TypeString, + Computed: true, + }, + "cidr": { Type: schema.TypeString, Computed: true, @@ -72,6 +77,7 @@ func dataSourceHerokuSpaceRead(d *schema.ResourceData, m interface{}) error { space := spaceRaw.(*spaceWithNAT) d.SetId(name) + d.Set("uuid", space.ID) d.Set("state", space.State) d.Set("shield", space.Shield)