func resourceAliCloudSaeApplication()

in alicloud/resource_alicloud_sae_application.go [15:830]


func resourceAliCloudSaeApplication() *schema.Resource {
	return &schema.Resource{
		Create: resourceAliCloudSaeApplicationCreate,
		Read:   resourceAliCloudSaeApplicationRead,
		Update: resourceAliCloudSaeApplicationUpdate,
		Delete: resourceAliCloudSaeApplicationDelete,
		Importer: &schema.ResourceImporter{
			State: schema.ImportStatePassthrough,
		},
		Schema: map[string]*schema.Schema{
			"app_name": {
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},
			"package_type": {
				Type:         schema.TypeString,
				Required:     true,
				ForceNew:     true,
				ValidateFunc: StringInSlice([]string{"FatJar", "War", "Image", "PhpZip", "IMAGE_PHP_5_4", "IMAGE_PHP_5_4_ALPINE", "IMAGE_PHP_5_5", "IMAGE_PHP_5_5_ALPINE", "IMAGE_PHP_5_6", "IMAGE_PHP_5_6_ALPINE", "IMAGE_PHP_7_0", "IMAGE_PHP_7_0_ALPINE", "IMAGE_PHP_7_1", "IMAGE_PHP_7_1_ALPINE", "IMAGE_PHP_7_2", "IMAGE_PHP_7_2_ALPINE", "IMAGE_PHP_7_3", "IMAGE_PHP_7_3_ALPINE", "PythonZip"}, false),
			},
			"replicas": {
				Type:     schema.TypeInt,
				Required: true,
			},
			"namespace_id": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
			},
			"vpc_id": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
			},
			"vswitch_id": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"package_version": {
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},
			"package_url": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"image_url": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"cpu": {
				Type:         schema.TypeInt,
				Optional:     true,
				ValidateFunc: IntInSlice([]int{500, 1000, 2000, 4000, 8000, 16000, 32000}),
			},
			"memory": {
				Type:         schema.TypeInt,
				Optional:     true,
				ValidateFunc: IntInSlice([]int{1024, 2048, 4096, 8192, 12288, 16384, 24576, 32768, 65536, 131072}),
			},
			"command": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"web_container": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"jdk": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"jar_start_options": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"jar_start_args": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"app_description": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"auto_config": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"auto_enable_application_scaling_rule": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"batch_wait_time": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"change_order_desc": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"deploy": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"edas_container_version": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"enable_ahas": {
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},
			"enable_grey_tag_route": {
				Type:     schema.TypeBool,
				Optional: true,
				Computed: true,
				DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
					return d.Get("enable_grey_tag_route").(bool)
				},
			},
			"min_ready_instances": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"min_ready_instance_ratio": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"oss_ak_id": {
				Type:      schema.TypeString,
				Optional:  true,
				Sensitive: true,
			},
			"oss_ak_secret": {
				Type:      schema.TypeString,
				Optional:  true,
				Sensitive: true,
			},
			"php_arms_config_location": {
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},
			"php_config": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"php_config_location": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"security_group_id": {
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},
			"termination_grace_period_seconds": {
				Type:         schema.TypeInt,
				Optional:     true,
				Computed:     true,
				ValidateFunc: IntBetween(1, 60),
			},
			"timezone": {
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},
			"war_start_options": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"acr_instance_id": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"acr_assume_role_arn": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"micro_registration": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: StringInSlice([]string{"0", "1", "2"}, false),
			},
			"envs": {
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},
			"sls_configs": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"php": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"image_pull_secrets": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"programming_language": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Computed: true,
			},
			"command_args_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"command_args"},
				Elem:          &schema.Schema{Type: schema.TypeString},
			},
			"custom_host_alias_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"custom_host_alias"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"host_name": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"ip": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
					},
				},
			},
			"oss_mount_descs_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"oss_mount_descs"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"bucket_name": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"bucket_path": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"mount_path": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"read_only": {
							Type:     schema.TypeBool,
							Optional: true,
							Computed: true,
						},
					},
				},
			},
			"config_map_mount_desc_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"config_map_mount_desc"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"config_map_id": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"mount_path": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"key": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
					},
				},
			},
			"liveness_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				MaxItems:      1,
				ConflictsWith: []string{"liveness"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"initial_delay_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"period_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"timeout_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"exec": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"command": {
										Type:     schema.TypeList,
										Optional: true,
										Computed: true,
										Elem:     &schema.Schema{Type: schema.TypeString},
									},
								},
							},
						},
						"tcp_socket": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
										Computed: true,
									},
								},
							},
						},
						"http_get": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"path": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
										Computed: true,
									},
									"scheme": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"key_word": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"is_contain_key_word": {
										Type:     schema.TypeBool,
										Optional: true,
										Computed: true,
									},
								},
							},
						},
					},
				},
			},
			"readiness_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				MaxItems:      1,
				ConflictsWith: []string{"readiness"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"initial_delay_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"period_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"timeout_seconds": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"exec": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"command": {
										Type:     schema.TypeList,
										Optional: true,
										Computed: true,
										Elem:     &schema.Schema{Type: schema.TypeString},
									},
								},
							},
						},
						"tcp_socket": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
										Computed: true,
									},
								},
							},
						},
						"http_get": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"path": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
										Computed: true,
									},
									"scheme": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"key_word": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"is_contain_key_word": {
										Type:     schema.TypeBool,
										Optional: true,
										Computed: true,
									},
								},
							},
						},
					},
				},
			},
			"post_start_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				MaxItems:      1,
				ConflictsWith: []string{"post_start"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"exec": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"command": {
										Type:     schema.TypeList,
										Optional: true,
										Computed: true,
										Elem:     &schema.Schema{Type: schema.TypeString},
									},
								},
							},
						},
					},
				},
			},
			"pre_stop_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				MaxItems:      1,
				ConflictsWith: []string{"pre_stop"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"exec": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"command": {
										Type:     schema.TypeList,
										Optional: true,
										Computed: true,
										Elem:     &schema.Schema{Type: schema.TypeString},
									},
								},
							},
						},
					},
				},
			},
			"tomcat_config_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				MaxItems:      1,
				ConflictsWith: []string{"tomcat_config"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"port": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"max_threads": {
							Type:     schema.TypeInt,
							Optional: true,
							Computed: true,
						},
						"context_path": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"uri_encoding": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"use_body_encoding_for_uri": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
					},
				},
			},
			"update_strategy_v2": {
				Type:          schema.TypeList,
				Optional:      true,
				Computed:      true,
				MaxItems:      1,
				ConflictsWith: []string{"update_strategy"},
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"type": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"batch_update": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"release_type": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"batch": {
										Type:     schema.TypeInt,
										Optional: true,
										Computed: true,
									},
									"batch_wait_time": {
										Type:     schema.TypeInt,
										Optional: true,
										Computed: true,
									},
								},
							},
						},
					},
				},
			},
			"nas_configs": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"nas_id": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"nas_path": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"mount_path": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"mount_domain": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"read_only": {
							Type:     schema.TypeBool,
							Optional: true,
						},
					},
				},
			},
			"kafka_configs": {
				Type:     schema.TypeList,
				Optional: true,
				MaxItems: 1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"kafka_instance_id": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"kafka_endpoint": {
							Type:     schema.TypeString,
							Optional: true,
						},
						"kafka_configs": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"log_type": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"log_dir": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"kafka_topic": {
										Type:     schema.TypeString,
										Optional: true,
									},
								},
							},
						},
					},
				},
			},
			"pvtz_discovery_svc": {
				Type:     schema.TypeList,
				Optional: true,
				MaxItems: 1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"service_name": {
							Type:     schema.TypeString,
							Optional: true,
							ForceNew: true,
						},
						"namespace_id": {
							Type:     schema.TypeString,
							Optional: true,
							ForceNew: true,
						},
						"enable": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"port_protocols": {
							Type:     schema.TypeList,
							Optional: true,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"port": {
										Type:     schema.TypeInt,
										Optional: true,
									},
									"protocol": {
										Type:     schema.TypeString,
										Optional: true,
									},
								},
							},
						},
					},
				},
			},
			"tags": tagsSchema(),
			"status": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: StringInSlice([]string{"RUNNING", "STOPPED", "UNKNOWN"}, false),
			},
			"command_args": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"command_args_v2"},
				Deprecated:    "Field `command_args` has been deprecated from provider version 1.211.0. New field `command_args_v2` instead.",
			},
			"custom_host_alias": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"custom_host_alias_v2"},
				Deprecated:    "Field `custom_host_alias` has been deprecated from provider version 1.211.0. New field `custom_host_alias_v2` instead.",
			},
			"oss_mount_descs": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"oss_mount_descs_v2"},
				Deprecated:    "Field `oss_mount_descs` has been deprecated from provider version 1.211.0. New field `oss_mount_descs_v2` instead.",
			},
			"config_map_mount_desc": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"config_map_mount_desc_v2"},
				Deprecated:    "Field `config_map_mount_desc` has been deprecated from provider version 1.211.0. New field `config_map_mount_desc_v2` instead.",
			},
			"liveness": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"liveness_v2"},
				Deprecated:    "Field `liveness` has been deprecated from provider version 1.211.0. New field `liveness_v2` instead.",
			},
			"readiness": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"readiness_v2"},
				Deprecated:    "Field `readiness` has been deprecated from provider version 1.211.0. New field `readiness_v2` instead.",
			},
			"post_start": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"post_start_v2"},
				Deprecated:    "Field `post_start` has been deprecated from provider version 1.211.0. New field `post_start_v2` instead.",
			},
			"pre_stop": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"pre_stop_v2"},
				Deprecated:    "Field `pre_stop` has been deprecated from provider version 1.211.0. New field `pre_stop_v2` instead.",
			},
			"tomcat_config": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"tomcat_config_v2"},
				Deprecated:    "Field `tomcat_config` has been deprecated from provider version 1.211.0. New field `tomcat_config_v2` instead.",
			},
			"update_strategy": {
				Type:          schema.TypeString,
				Optional:      true,
				Computed:      true,
				ConflictsWith: []string{"update_strategy_v2"},
				Deprecated:    "Field `update_strategy` has been deprecated from provider version 1.211.0. New field `update_strategy_v2` instead.",
			},
			"nas_id": {
				Type:     schema.TypeString,
				Optional: true,
				Removed:  "Field `nas_id` has been removed from provider version 1.211.0.",
			},
			"mount_host": {
				Type:     schema.TypeString,
				Optional: true,
				Removed:  "Field `mount_host` has been removed from provider version 1.211.0.",
			},
			"mount_desc": {
				Type:     schema.TypeString,
				Optional: true,
				Removed:  "Field `mount_desc` has been removed from provider version 1.211.0.",
			},
			"version_id": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Removed:  "Field `version_id` has been removed from provider version 1.211.0.",
			},
		},
	}
}