Skip to content

Commit

Permalink
Make master_image required only if gallery_image is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
aneeshk-citrix committed Dec 1, 2023
1 parent 8ce5dac commit 0dc4cac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/resources/daas_machine_catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ Required:

- `hypervisor` (String) Id of the hypervisor for creating the machines.
- `hypervisor_resource_pool` (String) Id of the hypervisor resource pool that will be used for provisioning operations.
- `master_image` (String) The name of the virtual machine snapshot or VM template that will be used. This identifies the hard disk to be used and the default values for the memory and processors.

Optional:

Expand All @@ -161,6 +160,7 @@ Optional:
- `image_ami` (String) **[AWS: Required]** AMI of the AWS image to be used as the template image for the machine catalog.
- `machine_profile` (String) **[GCP: Optional]** The name of the virtual machine template that will be used to identify the default value for the tags, virtual machine size, boot diagnostics, host cache property of OS disk, accelerated networking and availability zone. If not specified, the VM specified in master_image will be used as template.
- `machine_snapshot` (String) **[GCP: Optional]** The name of the virtual machine snapshot of a GCP VM that will be used as master image.
- `master_image` (String) **[AWS, GCP: Required | Azure: Optional]** The name of the virtual machine snapshot or VM template that will be used. This identifies the hard disk to be used and the default values for the memory and processors. For Azure, skip this if you want to use gallery_image.
- `resource_group` (String) **[Azure: Required]** The Azure Resource Group where the image VHD for creating machines is located.
- `service_offering` (String) **[Azure, AWS: Required]** The VM Sku of a Cloud service offering to use when creating machines.
- `storage_account` (String) **[Azure: Optional]** The Azure Storage Account where the image VHD for creating machines is located. Only applicable to Azure VHD image blob.
Expand Down
12 changes: 7 additions & 5 deletions internal/daas/machine_catalog_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,13 @@ func (r *machineCatalogResource) Schema(_ context.Context, _ resource.SchemaRequ
Optional: true,
},
"master_image": schema.StringAttribute{
Description: "The name of the virtual machine snapshot or VM template that will be used. This identifies the hard disk to be used and the default values for the memory and processors.",
Required: true,
Description: "**[AWS, GCP: Required | Azure: Optional]** The name of the virtual machine snapshot or VM template that will be used. This identifies the hard disk to be used and the default values for the memory and processors. For Azure, skip this if you want to use gallery_image.",
Optional: true,
Validators: []validator.String{
stringvalidator.ExactlyOneOf(path.Expressions{
path.MatchRelative().AtParent().AtName("gallery_image"),
}...),
},
},
"resource_group": schema.StringAttribute{
Description: "**[Azure: Required]** The Azure Resource Group where the image VHD for creating machines is located.",
Expand Down Expand Up @@ -197,9 +202,6 @@ func (r *machineCatalogResource) Schema(_ context.Context, _ resource.SchemaRequ
objectvalidator.ConflictsWith(path.Expressions{
path.MatchRelative().AtParent().AtName("container"),
}...),
objectvalidator.ConflictsWith(path.Expressions{
path.MatchRelative().AtParent().AtName("master_image"),
}...),
},
},
"image_ami": schema.StringAttribute{
Expand Down

0 comments on commit 0dc4cac

Please sign in to comment.