Skip to content

Commit

Permalink
Add Version Attributes To Boundary Cluster Resource & Data Source (#1089
Browse files Browse the repository at this point in the history
)

* Update Boundary cluster schema for version data

* Set the cluster version based on boundary model attribute(s)

* Add generated Boundary Docs

* Update go tests for new version resource attribute

* Add Readme
  • Loading branch information
RyanDerr authored Sep 11, 2024
1 parent b02a475 commit d1e7ef1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/1089.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
Added the `version` attribute(s) to `hcp_boundary_cluster` resource and data sources.
```
1 change: 1 addition & 0 deletions docs/data-sources/boundary_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ If a project is not configured in the HCP Provider config block, the oldest proj
- `maintenance_window_config` (List of Object) (see [below for nested schema](#nestedatt--maintenance_window_config))
- `state` (String) The state of the Boundary cluster.
- `tier` (String) The tier of the Boundary cluster.
- `version` (String) The version of the Boundary cluster.

<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`
Expand Down
1 change: 1 addition & 0 deletions docs/resources/boundary_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ If a project is not configured in the HCP Provider config block, the oldest proj
- `created_at` (String) The time that the Boundary cluster was created.
- `id` (String) The ID of this resource.
- `state` (String) The state of the Boundary cluster.
- `version` (String) The version of the Boundary cluster.

<a id="nestedblock--maintenance_window_config"></a>
### Nested Schema for `maintenance_window_config`
Expand Down
5 changes: 5 additions & 0 deletions internal/providersdkv2/data_source_boundary_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ If a project is not configured in the HCP Provider config block, the oldest proj
},
},
},
"version": {
Description: "The version of the Boundary cluster.",
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down
9 changes: 9 additions & 0 deletions internal/providersdkv2/resource_boundary_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ If a project is not configured in the HCP Provider config block, the oldest proj
},
},
},
"version": {
Description: "The version of the Boundary cluster.",
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -492,6 +497,10 @@ func setBoundaryClusterResourceData(d *schema.ResourceData, cluster *boundarymod
if err := d.Set("maintenance_window_config", []interface{}{mwConfig}); err != nil {
return err
}

if err := d.Set("version", cluster.BoundaryVersion); err != nil {
return err
}
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions internal/providersdkv2/resource_boundary_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func TestAccBoundaryCluster(t *testing.T) {
testAccCheckFullURL(boundaryClusterResourceName, "cluster_url", ""),
resource.TestCheckResourceAttrSet(boundaryClusterResourceName, "state"),
resource.TestCheckResourceAttr(boundaryClusterResourceName, "tier", "PLUS"),
resource.TestCheckResourceAttrSet(boundaryClusterResourceName, "version"),
),
},
{
Expand Down Expand Up @@ -96,6 +97,7 @@ func TestAccBoundaryCluster(t *testing.T) {
testAccCheckFullURL(boundaryClusterResourceName, "cluster_url", ""),
resource.TestCheckResourceAttrSet(boundaryClusterResourceName, "state"),
resource.TestCheckResourceAttr(boundaryClusterResourceName, "tier", "PLUS"),
resource.TestCheckResourceAttrSet(boundaryClusterResourceName, "version"),
),
},
{
Expand All @@ -108,6 +110,7 @@ func TestAccBoundaryCluster(t *testing.T) {
testAccCheckFullURL(boundaryClusterDataSourceName, "cluster_url", ""),
resource.TestCheckResourceAttrPair(boundaryClusterResourceName, "state", boundaryClusterDataSourceName, "state"),
resource.TestCheckResourceAttr(boundaryClusterResourceName, "tier", "PLUS"),
resource.TestCheckResourceAttrPair(boundaryClusterResourceName, "version", boundaryClusterDataSourceName, "version"),
),
},
{
Expand All @@ -125,6 +128,7 @@ func TestAccBoundaryCluster(t *testing.T) {
resource.TestCheckResourceAttr(boundaryClusterResourceName, "maintenance_window_config.0.day", "TUESDAY"),
resource.TestCheckResourceAttr(boundaryClusterResourceName, "maintenance_window_config.0.start", "2"),
resource.TestCheckResourceAttr(boundaryClusterResourceName, "maintenance_window_config.0.end", "12"),
resource.TestCheckResourceAttrSet(boundaryClusterResourceName, "version"),
),
},
},
Expand Down

0 comments on commit d1e7ef1

Please sign in to comment.