func resourceAlicloudEssEciScalingConfiguration()

in alicloud/resource_alicloud_ess_eci_scaling_configuration.go [17:726]


func resourceAlicloudEssEciScalingConfiguration() *schema.Resource {
	return &schema.Resource{
		Create: resourceAliyunEssEciScalingConfigurationCreate,
		Read:   resourceAliyunEssEciScalingConfigurationRead,
		Update: resourceAliyunEssEciScalingConfigurationUpdate,
		Delete: resourceAliyunEssEciScalingConfigurationDelete,
		Importer: &schema.ResourceImporter{
			State: schema.ImportStatePassthrough,
		},
		Timeouts: &schema.ResourceTimeout{
			Create: schema.DefaultTimeout(3 * time.Minute),
			Delete: schema.DefaultTimeout(3 * time.Minute),
		},
		Schema: map[string]*schema.Schema{
			"active": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"force_delete": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"scaling_group_id": {
				Type:     schema.TypeString,
				ForceNew: true,
				Required: true,
			},
			"scaling_configuration_name": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: StringMatch(regexp.MustCompile(`^[\\u4e00-\\u9fa5a-zA-Z0-9][\\u4e00-\\u9fa5a-zA-Z0-9\-_.]{1,63}$`), "It must be 2 to 64 characters in length and can contain letters, digits, underscores (_), hyphens (-), and periods (.). It must start with a letter or a digit."),
			},
			"description": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"security_group_id": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"container_group_name": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"restart_policy": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"cpu": {
				Type:     schema.TypeFloat,
				Optional: true,
			},
			"memory": {
				Type:     schema.TypeFloat,
				Optional: true,
			},
			"resource_group_id": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"dns_policy": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"cost_optimization": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"enable_sls": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"instance_family_level": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"image_snapshot_id": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"ram_role_name": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"termination_grace_period_seconds": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"auto_match_image_cache": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"ipv6_address_count": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"cpu_options_core": {
				Type:         schema.TypeInt,
				Optional:     true,
				ValidateFunc: IntAtLeast(1),
			},
			"cpu_options_threads_per_core": {
				Type:         schema.TypeInt,
				Optional:     true,
				ValidateFunc: IntAtLeast(1),
			},
			"active_deadline_seconds": {
				Type:         schema.TypeInt,
				Optional:     true,
				ValidateFunc: validation.IntAtLeast(1),
			},
			"spot_strategy": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"spot_price_limit": {
				Type:     schema.TypeFloat,
				Optional: true,
			},
			"auto_create_eip": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"eip_bandwidth": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"host_name": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"ingress_bandwidth": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"egress_bandwidth": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"ephemeral_storage": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"load_balancer_weight": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"tags": tagsSchema(),
			"acr_registry_infos": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"domains": {
							Type: schema.TypeSet,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
							Optional: true,
						},
						"instance_name": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"instance_id": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"region_id": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
			"image_registry_credentials": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"password": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"server": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"username": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
			"dns_config_options": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"name": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"value": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
			"security_context_sysctls": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"name": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"value": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
			"containers": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"security_context_capability_adds": {
							Type: schema.TypeList,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
							Optional: true,
						},
						"lifecycle_pre_stop_handler_execs": {
							Type: schema.TypeList,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
							Optional: true,
						},
						"security_context_read_only_root_file_system": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"tty": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"stdin": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"security_context_run_as_user": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"ports": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"protocol": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
									},
								},
							},
						},
						"environment_vars": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"key": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"value": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"field_ref_field_path": {
										Type:     schema.TypeString,
										Optional: true,
									},
								},
							},
						},
						"working_dir": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"args": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
						},
						"cpu": {
							Type:     schema.TypeFloat,
							Optional: true,
						},
						"gpu": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"memory": {
							Type:     schema.TypeFloat,
							Optional: true,
						},
						"name": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"image": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"image_pull_policy": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"volume_mounts": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"mount_path": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"mount_propagation": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"sub_path": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"name": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"read_only": {
										Type:     schema.TypeBool,
										Optional: true,
									},
								},
							},
						},
						"commands": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
						},
						"liveness_probe_exec_commands": {
							Type:     schema.TypeList,
							Elem:     &schema.Schema{Type: schema.TypeString},
							Optional: true,
						},
						"liveness_probe_period_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"liveness_probe_http_get_path": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"liveness_probe_failure_threshold": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"liveness_probe_initial_delay_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"liveness_probe_http_get_port": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"liveness_probe_http_get_scheme": {
							Type:         schema.TypeString,
							Optional:     true,
							ValidateFunc: validation.StringInSlice([]string{"HTTP", "HTTPS"}, false),
						},
						"liveness_probe_tcp_socket_port": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"liveness_probe_success_threshold": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"liveness_probe_timeout_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_exec_commands": {
							Type:     schema.TypeList,
							Elem:     &schema.Schema{Type: schema.TypeString},
							Optional: true,
						},
						"readiness_probe_period_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_http_get_path": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"readiness_probe_failure_threshold": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_initial_delay_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_http_get_port": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_http_get_scheme": {
							Type:         schema.TypeString,
							ValidateFunc: validation.StringInSlice([]string{"HTTP", "HTTPS"}, false),
							Optional:     true,
						},
						"readiness_probe_tcp_socket_port": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_success_threshold": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"readiness_probe_timeout_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
						},
					},
				},
			},
			"instance_types": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type:     schema.TypeString,
					MaxItems: 5,
				},
			},
			"init_containers": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"security_context_capability_adds": {
							Type: schema.TypeList,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
							Optional: true,
						},
						"security_context_read_only_root_file_system": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"security_context_run_as_user": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"ports": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"protocol": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
									},
								},
							},
						},
						"environment_vars": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"key": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"value": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"field_ref_field_path": {
										Type:     schema.TypeString,
										Optional: true,
									},
								},
							},
						},
						"working_dir": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"args": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
						},
						"cpu": {
							Type:     schema.TypeFloat,
							Optional: true,
						},
						"gpu": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"memory": {
							Type:     schema.TypeFloat,
							Optional: true,
						},
						"name": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"image": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"image_pull_policy": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"volume_mounts": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"mount_path": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"mount_propagation": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"sub_path": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"name": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"read_only": {
										Type:     schema.TypeBool,
										Optional: true,
									},
								},
							},
						},
						"commands": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
						},
					},
				},
			},
			"volumes": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"config_file_volume_config_file_to_paths": {
							Type:     schema.TypeSet,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"content": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"path": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"mode": {
										Type:     schema.TypeInt,
										Optional: true,
									},
								},
							},
						},
						"disk_volume_disk_id": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"host_path_volume_type": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"host_path_volume_path": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"config_file_volume_default_mode": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"empty_dir_volume_medium": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"empty_dir_volume_size_limit": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"disk_volume_fs_type": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"disk_volume_disk_size": {
							Type:     schema.TypeInt,
							Optional: true,
						},
						"flex_volume_driver": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"flex_volume_fs_type": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"flex_volume_options": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"nfs_volume_path": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"nfs_volume_read_only": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"nfs_volume_server": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"name": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"type": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
			"host_aliases": {
				Type:     schema.TypeSet,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"hostnames": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Schema{
								Type: schema.TypeString,
							},
						},
						"ip": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
		},
	}
}