-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for vlcm (offline software depots, cluster images) (#…
…2143) Signed-off-by: Stoyan Zhelyazkov <[email protected]> Signed-off-by: Ryan Johnson <[email protected]> Co-authored-by: Ryan Johnson <[email protected]>
- Loading branch information
1 parent
6eec7a9
commit 40e4997
Showing
11 changed files
with
556 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package vsphere | ||
|
||
import ( | ||
"github.com/vmware/govmomi/vapi/esx/settings/depots" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func dataSourceVSphereHostBaseImages() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceVSphereHostBaseImagesRead, | ||
Schema: map[string]*schema.Schema{ | ||
"version": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "The available ESXi versions.", | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceVSphereHostBaseImagesRead(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*Client).restClient | ||
if images, err := depots.NewManager(client).ListBaseImages(); err != nil { | ||
return err | ||
} else { | ||
versions := make([]string, len(images)) | ||
for i, image := range images { | ||
versions[i] = image.Version | ||
} | ||
|
||
d.SetId(versions[0]) | ||
return d.Set("version", versions) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.