func resourceVfxt()

in src/terraform/providers/terraform-provider-avere/resource_vfxt.go [46:705]


func resourceVfxt() *schema.Resource {
	return &schema.Resource{
		Create: resourceVfxtCreate,
		Read:   resourceVfxtRead,
		Update: resourceVfxtUpdate,
		Delete: resourceVfxtDelete,

		Schema: map[string]*schema.Schema{
			controller_address: {
				Type:         schema.TypeString,
				Optional:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			controller_admin_username: {
				Type:         schema.TypeString,
				Optional:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			controller_admin_password: {
				Type: schema.TypeString,
				// the ssh key will be used if the password is not specified
				Optional:  true,
				Sensitive: true,
			},
			controller_ssh_port: {
				Type:         schema.TypeInt,
				Optional:     true,
				ValidateFunc: validation.IntBetween(0, 65535),
			},
			run_local: {
				Type:     schema.TypeBool,
				Optional: true,
				Default:  false,
			},
			use_availability_zones: {
				Type:     schema.TypeBool,
				Optional: true,
				Default:  false,
				ForceNew: true,
			},
			allow_non_ascii: {
				Type:     schema.TypeBool,
				Optional: true,
				Default:  false,
			},
			location: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			platform: {
				Type:         schema.TypeString,
				Default:      PlatformAzure,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			azure_resource_group: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			azure_network_resource_group: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			azure_network_name: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			azure_subnet_name: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			ntp_servers: {
				Type:         schema.TypeString,
				Optional:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			timezone: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      DefaultTimezone,
				ValidateFunc: validation.StringInSlice(GetSupportedTimezones(), false),
			},
			dns_server: {
				Type:         schema.TypeString,
				Optional:     true,
				ValidateFunc: ValidateDnsServers,
			},
			dns_domain: {
				Type:         schema.TypeString,
				Optional:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			dns_search: {
				Type:         schema.TypeString,
				Optional:     true,
				ValidateFunc: validation.StringIsNotWhiteSpace,
			},
			proxy_uri: {
				Type:         schema.TypeString,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringDoesNotContainAny(" '\"$"),
			},
			cluster_proxy_uri: {
				Type:         schema.TypeString,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringDoesNotContainAny(" '\"$"),
			},
			image_id: {
				Type:         schema.TypeString,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: validation.StringDoesNotContainAny(" '\"$"),
			},
			vfxt_cluster_name: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: ValidateVfxtName,
			},
			vfxt_admin_password: {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				Sensitive:    true,
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
			},
			vfxt_ssh_key_data: {
				Type:         schema.TypeString,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: ValidateSSHKey,
			},
			vfxt_node_count: {
				Type:         schema.TypeInt,
				Required:     true,
				ValidateFunc: validation.IntBetween(MinNodesCount, MaxNodesCount),
			},
			node_size: {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Default:  ClusterSkuProd,
				ValidateFunc: validation.StringInSlice([]string{
					ClusterSkuUnsupportedTestFast,
					ClusterSkuUnsupportedTest,
					ClusterSkuProd,
				}, false),
			},
			node_cache_size: {
				Type:     schema.TypeInt,
				Optional: true,
				ForceNew: true,
				Default:  4096,
				ValidateFunc: validation.IntInSlice([]int{
					1024,
					4096,
					// per documentation: https://docs.microsoft.com/en-us/azure/avere-vfxt/avere-vfxt-deploy-plan#vfxt-node-size
					8192,
				}),
			},
			enable_nlm: {
				Type:     schema.TypeBool,
				Optional: true,
				Default:  true,
			},
			vserver_first_ip: {
				Type:         schema.TypeString,
				Optional:     true,
				ForceNew:     true,
				Default:      "",
				ValidateFunc: validation.IsIPv4Address,
				RequiredWith: []string{vserver_ip_count},
			},
			vserver_ip_count: {
				Type:         schema.TypeInt,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: validation.IntBetween(MinVserverIpCount, MaxVserverIpCount),
				RequiredWith: []string{vserver_first_ip},
			},
			global_custom_settings: {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Schema{
					Type:         schema.TypeString,
					ValidateFunc: ValidateCustomSetting,
				},
				Set: schema.HashString,
			},
			vserver_settings: {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Schema{
					Type:         schema.TypeString,
					ValidateFunc: ValidateCustomSetting,
				},
				Set: schema.HashString,
			},
			enable_support_uploads: {
				Type:     schema.TypeBool,
				Optional: true,
				Default:  false,
			},
			support_uploads_company_name: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny("'\""),
				RequiredWith: []string{enable_support_uploads},
			},
			enable_rolling_trace_data: {
				Type:         schema.TypeBool,
				Optional:     true,
				Default:      false,
				RequiredWith: []string{enable_support_uploads},
			},
			rolling_trace_flag: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      DefaultRollingTraceFlag,
				ValidateFunc: validation.StringDoesNotContainAny("'\""),
				RequiredWith: []string{enable_support_uploads, enable_rolling_trace_data},
			},
			active_support_upload: {
				Type:         schema.TypeBool,
				Optional:     true,
				Default:      false,
				RequiredWith: []string{enable_support_uploads},
			},
			enable_secure_proactive_support: {
				Type:     schema.TypeString,
				Optional: true,
				Default:  ProactiveSupportDisabled,
				ValidateFunc: validation.StringInSlice([]string{
					ProactiveSupportDisabled,
					ProactiveSupportSupport,
					ProactiveSupportAPI,
					ProactiveSupportFull,
				}, false),
				RequiredWith: []string{enable_support_uploads},
			},
			cifs_ad_domain: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: ValidateCIFSDomain,
				RequiredWith: []string{cifs_netbios_domain_name, cifs_dc_addreses, cifs_server_name, cifs_username, cifs_password},
			},
			cifs_netbios_domain_name: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: ValidateNetbiosNameRegexp,
				RequiredWith: []string{cifs_ad_domain, cifs_dc_addreses, cifs_server_name, cifs_username, cifs_password},
			},
			cifs_dc_addreses: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: ValidateDnsServers,
				RequiredWith: []string{cifs_ad_domain, cifs_netbios_domain_name, cifs_server_name, cifs_username, cifs_password},
			},
			cifs_server_name: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: ValidateCIFSServerName,
				RequiredWith: []string{cifs_ad_domain, cifs_netbios_domain_name, cifs_dc_addreses, cifs_username, cifs_password},
			},
			cifs_username: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: ValidateCIFSUsername,
				RequiredWith: []string{cifs_ad_domain, cifs_netbios_domain_name, cifs_dc_addreses, cifs_server_name, cifs_password},
			},
			cifs_password: {
				Type:         schema.TypeString,
				Optional:     true,
				Sensitive:    true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
				RequiredWith: []string{cifs_ad_domain, cifs_netbios_domain_name, cifs_dc_addreses, cifs_server_name, cifs_username},
			},
			cifs_flatfile_passwd_uri: {
				Type:          schema.TypeString,
				Optional:      true,
				Default:       "",
				ValidateFunc:  validation.StringDoesNotContainAny(" '\""),
				RequiredWith:  []string{cifs_ad_domain, cifs_server_name, cifs_password, cifs_flatfile_group_uri},
				ConflictsWith: []string{cifs_flatfile_passwd_b64z, cifs_flatfile_group_b64z, cifs_rid_mapping_base_integer},
			},
			cifs_flatfile_group_uri: {
				Type:          schema.TypeString,
				Optional:      true,
				Default:       "",
				ValidateFunc:  validation.StringDoesNotContainAny(" '\""),
				RequiredWith:  []string{cifs_ad_domain, cifs_server_name, cifs_password, cifs_flatfile_passwd_uri},
				ConflictsWith: []string{cifs_flatfile_passwd_b64z, cifs_flatfile_group_b64z, cifs_rid_mapping_base_integer},
			},
			cifs_flatfile_passwd_b64z: {
				Type:          schema.TypeString,
				Optional:      true,
				Default:       "",
				ValidateFunc:  validation.StringDoesNotContainAny(" '\""),
				RequiredWith:  []string{cifs_ad_domain, cifs_server_name, cifs_password, cifs_flatfile_group_b64z},
				ConflictsWith: []string{cifs_flatfile_passwd_uri, cifs_flatfile_group_uri, cifs_rid_mapping_base_integer},
			},
			cifs_flatfile_group_b64z: {
				Type:          schema.TypeString,
				Optional:      true,
				Default:       "",
				ValidateFunc:  validation.StringDoesNotContainAny(" '\""),
				RequiredWith:  []string{cifs_ad_domain, cifs_server_name, cifs_password, cifs_flatfile_passwd_b64z},
				ConflictsWith: []string{cifs_flatfile_passwd_uri, cifs_flatfile_group_uri, cifs_rid_mapping_base_integer},
			},
			cifs_rid_mapping_base_integer: {
				Type:          schema.TypeInt,
				Optional:      true,
				Default:       0,
				ValidateFunc:  validation.IntAtLeast(0),
				RequiredWith:  []string{cifs_ad_domain, cifs_server_name, cifs_password},
				ConflictsWith: []string{cifs_flatfile_passwd_uri, cifs_flatfile_group_uri, cifs_flatfile_passwd_b64z, cifs_flatfile_group_b64z},
			},
			cifs_organizational_unit: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: ValidateOrganizationalUnit,
				RequiredWith: []string{cifs_ad_domain, cifs_server_name, cifs_username, cifs_password},
			},
			cifs_trusted_active_directory_domains: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny("'\""),
				RequiredWith: []string{cifs_ad_domain, cifs_server_name, cifs_username, cifs_password},
			},
			enable_extended_groups: {
				Type:         schema.TypeBool,
				Optional:     true,
				Default:      false,
				RequiredWith: []string{cifs_ad_domain, cifs_server_name, cifs_username, cifs_password},
			},
			login_services_ldap_server: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
				RequiredWith: []string{login_services_ldap_basedn, login_services_ldap_binddn, login_services_ldap_bind_password},
			},
			login_services_ldap_basedn: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
				RequiredWith: []string{login_services_ldap_server, login_services_ldap_binddn, login_services_ldap_bind_password},
			},
			login_services_ldap_binddn: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
				RequiredWith: []string{login_services_ldap_server, login_services_ldap_basedn, login_services_ldap_bind_password},
			},
			login_services_ldap_bind_password: {
				Type:         schema.TypeString,
				Optional:     true,
				Sensitive:    true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
				RequiredWith: []string{login_services_ldap_server, login_services_ldap_basedn, login_services_ldap_binddn},
			},
			user_assigned_managed_identity: {
				Type:         schema.TypeString,
				Optional:     true,
				Default:      "",
				ValidateFunc: validation.StringDoesNotContainAny(" '\""),
			},
			user: {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						name: {
							Type:         schema.TypeString,
							Required:     true,
							ValidateFunc: ValidateUserName,
						},
						password: {
							Type:         schema.TypeString,
							Required:     true,
							Sensitive:    true,
							ValidateFunc: validation.StringLenBetween(1, 36),
						},
						permission: {
							Type:     schema.TypeString,
							Required: true,
							ValidateFunc: validation.StringInSlice([]string{
								UserReadOnly,
								UserReadWrite,
							}, false),
						},
					},
				},
				Set: resourceAvereUserReferenceHash,
			},
			core_filer: {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						core_filer_name: {
							Type:         schema.TypeString,
							Required:     true,
							ValidateFunc: validation.StringIsNotWhiteSpace,
						},
						fqdn_or_primary_ip: {
							Type:         schema.TypeString,
							Required:     true,
							ValidateFunc: validation.StringIsNotWhiteSpace,
						},
						filer_class: {
							Type:     schema.TypeString,
							Optional: true,
							Default:  FilerClassOther,
							ValidateFunc: validation.StringInSlice([]string{
								FilerClassNetappNonClustered,
								FilerClassNetappClustered,
								FilerClassEMCIsilon,
								FilerClassOther,
							}, false),
						},
						cache_policy: {
							Type:         schema.TypeString,
							Required:     true,
							ValidateFunc: ValidateCachePolicy,
						},
						auto_wan_optimize: {
							Type:     schema.TypeBool,
							Optional: true,
							Default:  true,
						},
						nfs_connection_multiplier: {
							Type:         schema.TypeInt,
							Optional:     true,
							Default:      DefaultNFSConnMult,
							ValidateFunc: validation.IntBetween(MinNFSConnMult, MaxNFSConnMult),
						},
						ordinal: {
							Type:     schema.TypeInt,
							Optional: true,
							Default:  0,
						},
						fixed_quota_percent: {
							Type:         schema.TypeInt,
							Optional:     true,
							Default:      0,
							ValidateFunc: validation.IntBetween(MinFixedQuotaPercent, MaxFixedQuotaPercent),
						},
						custom_settings: {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Schema{
								Type:         schema.TypeString,
								ValidateFunc: ValidateCustomSetting,
							},
							Set: schema.HashString,
						},
						junction: {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									namespace_path: {
										Type:         schema.TypeString,
										Required:     true,
										ValidateFunc: validation.StringIsNotWhiteSpace,
									},
									cifs_share_name: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      "",
										ValidateFunc: ValidateCIFSShareName,
									},
									core_filer_cifs_share_name: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      "",
										ValidateFunc: ValidateCIFSShareName,
									},
									cifs_share_ace: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      AceDefault,
										ValidateFunc: ValidateCIFSShareAce,
									},
									cifs_create_mask: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      "",
										ValidateFunc: ValidateCIFSMask,
									},
									cifs_dir_mask: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      "",
										ValidateFunc: ValidateCIFSMask,
									},
									core_filer_export: {
										Type:         schema.TypeString,
										Required:     true,
										ValidateFunc: validation.StringIsNotWhiteSpace,
									},
									export_subdirectory: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      "",
										ValidateFunc: ValidateExportSubdirectory,
									},
									export_rule: {
										Type:         schema.TypeString,
										Optional:     true,
										Default:      "",
										ValidateFunc: ValidateExportRule,
									},
								},
							},
						},
					},
				},
				Set: resourceAvereVfxtCoreFilerReferenceHash,
			},
			azure_storage_filer: {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						account_name: {
							Type:         schema.TypeString,
							Required:     true,
							ValidateFunc: ValidateArmStorageAccountName,
						},
						container_name: {
							Type:         schema.TypeString,
							Required:     true,
							ValidateFunc: ValidateContainerName,
						},
						ordinal: {
							Type:     schema.TypeInt,
							Optional: true,
							Default:  0,
						},
						custom_settings: {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Schema{
								Type:         schema.TypeString,
								ValidateFunc: ValidateCustomSetting,
							},
							Set: schema.HashString,
						},
						junction_namespace_path: {
							Type:         schema.TypeString,
							Optional:     true,
							ValidateFunc: validation.StringIsNotWhiteSpace,
						},
						cifs_share_name: {
							Type:         schema.TypeString,
							Optional:     true,
							Default:      "",
							ValidateFunc: ValidateCIFSShareName,
						},
						cifs_share_ace: {
							Type:         schema.TypeString,
							Optional:     true,
							Default:      AceDefault,
							ValidateFunc: ValidateCIFSShareAce,
						},
						cifs_create_mask: {
							Type:         schema.TypeString,
							Optional:     true,
							Default:      "",
							ValidateFunc: ValidateCIFSMask,
						},
						cifs_dir_mask: {
							Type:         schema.TypeString,
							Optional:     true,
							Default:      "",
							ValidateFunc: ValidateCIFSMask,
						},
						export_rule: {
							Type:         schema.TypeString,
							Optional:     true,
							Default:      "",
							ValidateFunc: ValidateExportRule,
						},
					},
				},
				Set: resourceAvereVfxtAzureStorageCoreFilerReferenceHash,
			},
			vfxt_management_ip: {
				Type:     schema.TypeString,
				Computed: true,
			},
			vserver_ip_addresses: {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			node_names: {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			mass_filer_mappings: {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			primary_cluster_ips: {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			licensing_id: {
				Type:     schema.TypeString,
				Computed: true,
			},
			tags: {
				Type:         schema.TypeMap,
				Optional:     true,
				Computed:     false,
				ForceNew:     true,
				ValidateFunc: ValidateTags,
			},
		},
	}
}