Skip to content

Commit

Permalink
Updated datasource cloudtemple_compute_datastore_cluster to make the …
Browse files Browse the repository at this point in the history
…filter datacenter_id mandatory
  • Loading branch information
pbesret committed Oct 11, 2023
1 parent 207d829 commit ee68415
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 39 deletions.
5 changes: 4 additions & 1 deletion docs/data-sources/compute_datastore_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ data "cloudtemple_compute_datastore_cluster" "name" {
<!-- schema generated by tfplugindocs -->
## Schema

### Optional
### Required

- `datacenter_id` (String)

### Optional

- `host_cluster_id` (String)
- `host_id` (String)
- `machine_manager_id` (String)
Expand Down
6 changes: 1 addition & 5 deletions internal/provider/data_source_compute_datastore_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,24 @@ func dataSourceDatastoreCluster() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ConflictsWith: []string{"id"},
AtLeastOneOf: []string{"id", "name"},
},
"datacenter_id": {
Type: schema.TypeString,
Optional: true,
Required: true,
Default: "",
ConflictsWith: []string{"id"},
AtLeastOneOf: []string{"id", "name"},
},
"host_id": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: []string{"id"},
AtLeastOneOf: []string{"id", "name"},
},
"host_cluster_id": {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: []string{"id"},
AtLeastOneOf: []string{"id", "name"},
},

// Out
Expand Down
56 changes: 32 additions & 24 deletions internal/provider/data_source_compute_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,44 +62,52 @@ func dataSourceNetwork() *schema.Resource {
ConflictsWith: []string{"id"},
},
"machine_manager_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"datacenter_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"virtual_machine_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Network", "DistributedVirtualPortgroup"}, false),
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Network", "DistributedVirtualPortgroup"}, false),
ConflictsWith: []string{"id"},
},
"virtual_switch_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"host_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"folder_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"host_cluster_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},

// Out
Expand Down
21 changes: 12 additions & 9 deletions internal/provider/data_source_compute_virtual_switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,22 @@ func dataSourceVirtualSwitch() *schema.Resource {
ConflictsWith: []string{"id"},
},
"machine_manager_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"datacenter_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},
"host_cluster_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
ConflictsWith: []string{"id"},
},

// Out
Expand Down

0 comments on commit ee68415

Please sign in to comment.