@@ -43,22 +43,48 @@ type InstancePoolDiskSpec struct {
4343 DiskSize int32 `json:"disk_size,omitempty"`
4444}
4545
46+ type AwsAllocationStrategy string
47+
48+ const (
49+ // AwsAllocationStrategyLowestPrice is allocation type for AWS Instance fleets
50+ AwsAllocationStrategyLowestPrice = "LOWEST_PRICE"
51+ // AwsAllocationStrategyCapacityOptimized is allocation type for AWS Instance fleets
52+ AwsAllocationStrategyCapacityOptimized = "CAPACITY_OPTIMIZED"
53+ )
54+
55+ type AwsFleetOption struct {
56+ AllocationStrategy AwsAllocationStrategy `json:"allocation_strategy" tf:"force_new,suppress_diff"`
57+ InstancePoolsToUseCount int32 `json:"instance_pools_to_use_count,omitempty" tf:"suppress_diff"`
58+ }
59+
60+ type AwsFleetLaunchTemplateOverride struct {
61+ AvailabilityZone string `json:"availability_zone" tf:"force_new,suppress_diff"`
62+ InstanceType string `json:"instance_type" tf:"force_new,suppress_diff"`
63+ }
64+
65+ type AwsInstancePoolFleetAttributes struct {
66+ FleetSpotOption * AwsFleetOption `json:"fleet_spot_option,omitempty" tf:"force_new,suppress_diff,conflicts:fleet_on_demand_option"`
67+ FleetOnDemandOption * AwsFleetOption `json:"fleet_on_demand_option,omitempty" tf:"force_new,suppress_diff,conflicts:fleet_spot_option"`
68+ FleetLaunchTemplateOverride []AwsFleetLaunchTemplateOverride `json:"launch_template_overrides" tf:"suppress_diff,force_new,slice_set,alias:launch_template_override"`
69+ }
70+
4671// InstancePool describes the instance pool object on Databricks
4772type InstancePool struct {
48- InstancePoolID string `json:"instance_pool_id,omitempty" tf:"computed"`
49- InstancePoolName string `json:"instance_pool_name"`
50- MinIdleInstances int32 `json:"min_idle_instances,omitempty"`
51- MaxCapacity int32 `json:"max_capacity,omitempty" tf:"suppress_diff"`
52- IdleInstanceAutoTerminationMinutes int32 `json:"idle_instance_autotermination_minutes"`
53- AwsAttributes * InstancePoolAwsAttributes `json:"aws_attributes,omitempty" tf:"force_new,suppress_diff"`
54- AzureAttributes * InstancePoolAzureAttributes `json:"azure_attributes,omitempty" tf:"force_new,suppress_diff"`
55- GcpAttributes * InstancePoolGcpAttributes `json:"gcp_attributes,omitempty" tf:"force_new,suppress_diff"`
56- NodeTypeID string `json:"node_type_id" tf:"force_new"`
57- CustomTags map [string ]string `json:"custom_tags,omitempty" tf:"force_new"`
58- EnableElasticDisk bool `json:"enable_elastic_disk,omitempty" tf:"force_new,suppress_diff"`
59- DiskSpec * InstancePoolDiskSpec `json:"disk_spec,omitempty" tf:"force_new"`
60- PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty" tf:"force_new"`
61- PreloadedDockerImages []clusters.DockerImage `json:"preloaded_docker_images,omitempty" tf:"force_new,slice_set,alias:preloaded_docker_image"`
73+ InstancePoolID string `json:"instance_pool_id,omitempty" tf:"computed"`
74+ InstancePoolName string `json:"instance_pool_name"`
75+ MinIdleInstances int32 `json:"min_idle_instances,omitempty"`
76+ MaxCapacity int32 `json:"max_capacity,omitempty" tf:"suppress_diff"`
77+ IdleInstanceAutoTerminationMinutes int32 `json:"idle_instance_autotermination_minutes"`
78+ AwsAttributes * InstancePoolAwsAttributes `json:"aws_attributes,omitempty" tf:"force_new,suppress_diff,computed"`
79+ AwsInstancePoolFleetAttributes * AwsInstancePoolFleetAttributes `json:"instance_pool_fleet_attributes,omitempty" tf:"force_new,suppress_diff,conflicts:node_type_id"`
80+ AzureAttributes * InstancePoolAzureAttributes `json:"azure_attributes,omitempty" tf:"force_new,suppress_diff"`
81+ GcpAttributes * InstancePoolGcpAttributes `json:"gcp_attributes,omitempty" tf:"force_new,suppress_diff"`
82+ NodeTypeID string `json:"node_type_id,omitempty" tf:"suppress_diff,force_new,conflicts:instance_pool_fleet_attributes"`
83+ CustomTags map [string ]string `json:"custom_tags,omitempty" tf:"force_new"`
84+ EnableElasticDisk bool `json:"enable_elastic_disk,omitempty" tf:"force_new,suppress_diff"`
85+ DiskSpec * InstancePoolDiskSpec `json:"disk_spec,omitempty" tf:"force_new"`
86+ PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty" tf:"force_new"`
87+ PreloadedDockerImages []clusters.DockerImage `json:"preloaded_docker_images,omitempty" tf:"force_new,slice_set,alias:preloaded_docker_image"`
6288}
6389
6490// InstancePoolStats contains the stats on a given pool
@@ -71,23 +97,24 @@ type InstancePoolStats struct {
7197
7298// InstancePoolAndStats encapsulates a get response from the GET api for instance pools on Databricks
7399type InstancePoolAndStats struct {
74- InstancePoolID string `json:"instance_pool_id,omitempty" tf:"computed"`
75- InstancePoolName string `json:"instance_pool_name"`
76- MinIdleInstances int32 `json:"min_idle_instances,omitempty"`
77- MaxCapacity int32 `json:"max_capacity,omitempty"`
78- AwsAttributes * InstancePoolAwsAttributes `json:"aws_attributes,omitempty"`
79- AzureAttributes * InstancePoolAzureAttributes `json:"azure_attributes,omitempty"`
80- GcpAttributes * InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"`
81- NodeTypeID string `json:"node_type_id"`
82- DefaultTags map [string ]string `json:"default_tags,omitempty" tf:"computed"`
83- CustomTags map [string ]string `json:"custom_tags,omitempty"`
84- IdleInstanceAutoTerminationMinutes int32 `json:"idle_instance_autotermination_minutes"`
85- EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"`
86- DiskSpec * InstancePoolDiskSpec `json:"disk_spec,omitempty"`
87- PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"`
88- State string `json:"state,omitempty"`
89- Stats * InstancePoolStats `json:"stats,omitempty"`
90- PreloadedDockerImages []clusters.DockerImage `json:"preloaded_docker_images,omitempty" tf:"slice_set,alias:preloaded_docker_image"`
100+ InstancePoolID string `json:"instance_pool_id,omitempty" tf:"computed"`
101+ InstancePoolName string `json:"instance_pool_name"`
102+ MinIdleInstances int32 `json:"min_idle_instances,omitempty"`
103+ MaxCapacity int32 `json:"max_capacity,omitempty"`
104+ AwsAttributes * InstancePoolAwsAttributes `json:"aws_attributes,omitempty"`
105+ AwsInstancePoolFleetAttributes []AwsInstancePoolFleetAttributes `json:"instance_pool_fleet_attributes,omitempty"`
106+ AzureAttributes * InstancePoolAzureAttributes `json:"azure_attributes,omitempty"`
107+ GcpAttributes * InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"`
108+ NodeTypeID string `json:"node_type_id,omitempty"`
109+ DefaultTags map [string ]string `json:"default_tags,omitempty" tf:"computed"`
110+ CustomTags map [string ]string `json:"custom_tags,omitempty"`
111+ IdleInstanceAutoTerminationMinutes int32 `json:"idle_instance_autotermination_minutes"`
112+ EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"`
113+ DiskSpec * InstancePoolDiskSpec `json:"disk_spec,omitempty"`
114+ PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"`
115+ State string `json:"state,omitempty"`
116+ Stats * InstancePoolStats `json:"stats,omitempty"`
117+ PreloadedDockerImages []clusters.DockerImage `json:"preloaded_docker_images,omitempty" tf:"slice_set,alias:preloaded_docker_image"`
91118}
92119
93120// InstancePoolList shows list of instance pools
@@ -185,6 +212,15 @@ func ResourceInstancePool() *schema.Resource {
185212 clusters .EbsVolumeTypeThroughputOptimizedHdd ,
186213 }, false )
187214 }
215+ if v , err := common .SchemaPath (s , "instance_pool_fleet_attributes" , "fleet_on_demand_option" , "allocation_strategy" ); err == nil {
216+ v .ValidateFunc = validation .StringInSlice ([]string {AwsAllocationStrategyLowestPrice }, false )
217+ }
218+ if v , err := common .SchemaPath (s , "instance_pool_fleet_attributes" , "fleet_spot_option" , "allocation_strategy" ); err == nil {
219+ v .ValidateFunc = validation .StringInSlice ([]string {
220+ AwsAllocationStrategyLowestPrice ,
221+ AwsAllocationStrategyCapacityOptimized ,
222+ }, false )
223+ }
188224 if v , err := common .SchemaPath (s , "preloaded_docker_image" , "url" ); err == nil {
189225 v .ForceNew = true
190226 }
0 commit comments