terraform-provider-vsphere icon indicating copy to clipboard operation
terraform-provider-vsphere copied to clipboard

Workload Managment Resource Need More Documentation and seperate namespace to differnete resource

Open orenr2301 opened this issue 4 months ago • 1 comments

Community Guidelines

  • [X] I have read and agree to the HashiCorp Community Guidelines .
  • [X] Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • [X] Do not leave "+1" or other comments that do not add relevant information or questions.
  • [X] If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

For a long time, we waited for the workload management resource so first of all thank you.

Secondly: The doc of the supervisor resource is very light! It just has a simple description of each attribute.

  • it doesn't show what are the requested types

  • Cannot know whether an attribute is optional or required

  • Doesn't show schemas of resource structure

  • Doesn't show if a block might be repeatable or not

  • No specific examples, and no description of other stuff

  • Also since each workload can have more than one namespace configured under it, you should set the namespace to a list object type, so a user can put more than one namespace

You should take into account, that not everyone who is familiar with Tanzu(tkgs), has expertise in vSpehere. Therefore you need to describe as well, if there are crucial dependencies, and there are.

Use Case(s)

I need to assign more namespaces under one workload management cluster, currently, it's not enabled in your code

Potential Terraform Provider Configuration

For the namespace thing please look at below

resource_vsphere_supervisor.go under func resourceVsphereSupervisor() *schema.Resource {

"namespace": {
				Type:        schema.TypeSet, ==> make it to be  "schema.TypeList" please 
				Optional:    true,
				Description: "List of namespaces associated with the cluster.",
				Elem:        namespaceSchema(),
			},
						

more say to be it dynamically so we can add multiple blocks

I Suggest to : 1) adding MinItems

"namespace": {
				Type:        schema.TypeSet, ==> make it to be  "schema.TypeList" please 
				Optional:    true,
				**MinItems:**    1, ==> tell it it can have more then one block and its repeatable 
				Description: "List of namespaces associated with the cluster.",
				Elem:        namespaceSchema(),
			},

For not having to call a function and maybe have it more organized, For you your judgment of course

Change the namespace scheme from:

"namespace": {
				Type:        schema.TypeSet,
				Optional:    true,
				Description: "List of namespaces associated with the cluster.",
				Elem:        namespaceSchema(),
			},

To:

"namespace": {
				Type:        schema.TypeList,
				Optional:    true,
				MinItem: 1
				Description: "List of namespaces associated with the cluster.",
				Elem:        &schema.Resource{
		                                Schema: map[string]*schema.Schema{
			                                      "name": {
				                                   Type:        schema.TypeString,
				                                   Required:    true,
				                                  Description: "The name of the namespace.",
			                                     },
			                                    "content_libraries": {
				                                Type:        schema.TypeList,
				                                Optional:    true,
				                                Description: "A list of content libraries.",
				                               Elem: &schema.Schema{
					                      Type: schema.TypeString,
				                            },
			                             },
			                               "vm_classes": {
				                           Type:        schema.TypeList,
				                          Optional:    true,
				                          Description: "A list of virtual machine classes.",
				                          Elem: &schema.Schema{
					                           Type: schema.TypeString,
				                    },
			                       },
			},

Also, you can take all of the blocks and create the schema in particular for each block and assign the element without having to have a return function that constructs the scheme back to the Elem key

Also if you would like to do so in addition you can create or have in the beginning some constant that will represent your resource keys/attributes and then use specKey whenever needed based on the scheme structure under the relevant schema

References

No response

orenr2301 avatar Sep 30 '24 21:09 orenr2301