Skip to content

Commit

Permalink
Add UUID to space data source (#378)
Browse files Browse the repository at this point in the history
* Add UUID so it fetches the Space.ID

* Update docs

---------

Co-authored-by: Mars Hall <[email protected]>
  • Loading branch information
AlfonsoCampodonico and mars authored Aug 14, 2023
1 parent da2d6b9 commit be0e791
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/data-sources/space.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
6 changes: 6 additions & 0 deletions heroku/data_source_heroku_space.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func dataSourceHerokuSpace() *schema.Resource {
Computed: true,
},

"uuid": {
Type: schema.TypeString,
Computed: true,
},

"cidr": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit be0e791

Please sign in to comment.