func resourceAliCloudServiceMeshServiceMesh()

in alicloud/resource_alicloud_service_mesh_service_mesh.go [17:548]


func resourceAliCloudServiceMeshServiceMesh() *schema.Resource {
	return &schema.Resource{
		Create: resourceAliCloudServiceMeshServiceMeshCreate,
		Read:   resourceAliCloudServiceMeshServiceMeshRead,
		Update: resourceAliCloudServiceMeshServiceMeshUpdate,
		Delete: resourceAliCloudServiceMeshServiceMeshDelete,
		Importer: &schema.ResourceImporter{
			State: schema.ImportStatePassthrough,
		},
		Timeouts: &schema.ResourceTimeout{
			Create: schema.DefaultTimeout(10 * time.Minute),
			Update: schema.DefaultTimeout(10 * time.Minute),
			Delete: schema.DefaultTimeout(20 * time.Minute),
		},
		Schema: map[string]*schema.Schema{
			"cluster_ids": {
				Type:     schema.TypeList,
				Optional: true,
				Elem:     &schema.Schema{Type: schema.TypeString},
			},
			"cluster_spec": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: StringInSlice([]string{"standard", "enterprise", "ultimate"}, false),
			},
			"create_time": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"customized_prometheus": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"edition": {
				Type:         schema.TypeString,
				Optional:     true,
				ForceNew:     true,
				ValidateFunc: StringInSlice([]string{"Default", "Pro"}, false),
			},
			"extra_configuration": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				MaxItems: 1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"cr_aggregation_enabled": {
							Type:     schema.TypeBool,
							Optional: true,
						},
					},
				},
			},
			"force": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"kubeconfig": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"load_balancer": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				MaxItems: 1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"api_server_loadbalancer_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"pilot_public_eip": {
							Type:     schema.TypeBool,
							Computed: true,
							Optional: true,
							ForceNew: true,
						},
						"pilot_public_loadbalancer_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"api_server_public_eip": {
							Type:     schema.TypeBool,
							Optional: true,
							ForceNew: true,
						},
						"pilot_public_eip_id": {
							Type:     schema.TypeString,
							Optional: true,
						},
					},
				},
			},
			"mesh_config": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				MaxItems: 1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"access_log": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"project": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"gateway_lifecycle": {
										Type:         schema.TypeInt,
										Optional:     true,
										Computed:     true,
										ValidateFunc: IntBetween(0, 365),
									},
									"gateway_enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"sidecar_lifecycle": {
										Type:         schema.TypeInt,
										Optional:     true,
										Computed:     true,
										ValidateFunc: IntBetween(0, 365),
									},
									"enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"sidecar_enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
								},
							},
						},
						"pilot": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"http10_enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"trace_sampling": {
										Type:     schema.TypeFloat,
										Optional: true,
									},
								},
							},
						},
						"opa": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"limit_memory": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"request_memory": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"limit_cpu": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"log_level": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"request_cpu": {
										Type:     schema.TypeString,
										Optional: true,
									},
								},
							},
						},
						"prometheus": {
							Type:     schema.TypeList,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"use_external": {
										Type:     schema.TypeBool,
										Computed: true,
									},
									"external_url": {
										Type:     schema.TypeString,
										Computed: true,
									},
								},
							},
						},
						"telemetry": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"outbound_traffic_policy": {
							Type:         schema.TypeString,
							Optional:     true,
							ValidateFunc: StringInSlice([]string{"ALLOW_ANY", "REGISTRY_ONLY"}, false),
						},
						"sidecar_injector": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"limit_memory": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"auto_injection_policy_enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"request_memory": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"enable_namespaces_by_default": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"limit_cpu": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"init_cni_configuration": {
										Type:     schema.TypeList,
										Optional: true,
										Computed: true,
										MaxItems: 1,
										Elem: &schema.Resource{
											Schema: map[string]*schema.Schema{
												"enabled": {
													Type:     schema.TypeBool,
													Optional: true,
												},
												"exclude_namespaces": {
													Type:     schema.TypeString,
													Optional: true,
												},
											},
										},
									},
									"request_cpu": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"sidecar_injector_webhook_as_yaml": {
										Type:     schema.TypeString,
										Computed: true,
									},
								},
							},
						},
						"audit": {
							Type:     schema.TypeList,
							Optional: true,
							Computed: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"project": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
									},
									"enabled": {
										Type:     schema.TypeBool,
										Optional: true,
										Computed: true,
									},
								},
							},
						},
						"kiali": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"aggregated_kiali_address": {
										Type:     schema.TypeString,
										Computed: true,
									},
									"integrate_clb": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"auth_strategy": {
										Type:         schema.TypeString,
										Optional:     true,
										Computed:     true,
										ValidateFunc: StringInSlice([]string{"token", "openid", "ramoauth"}, false),
									},
									"enabled": {
										Type:     schema.TypeBool,
										Optional: true,
									},
									"kiali_arms_auth_tokens": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"open_id_config": {
										Type:     schema.TypeList,
										Optional: true,
										MaxItems: 1,
										Elem: &schema.Resource{
											Schema: map[string]*schema.Schema{
												"issuer_uri": {
													Type:     schema.TypeString,
													Optional: true,
												},
												"client_secret": {
													Type:     schema.TypeString,
													Optional: true,
												},
												"scopes": {
													Type:     schema.TypeList,
													Optional: true,
													Elem:     &schema.Schema{Type: schema.TypeString},
												},
												"client_id": {
													Type:     schema.TypeString,
													Optional: true,
												},
											},
										},
									},
									"url": {
										Type:     schema.TypeString,
										Computed: true,
									},
									"distributed_kiali_addresses": {
										Type:     schema.TypeString,
										Computed: true,
									},
									"use_populated_arms_prometheus": {
										Type:     schema.TypeBool,
										Computed: true,
									},
									"server_config": {
										Type:     schema.TypeList,
										Optional: true,
										MaxItems: 1,
										Elem: &schema.Resource{
											Schema: map[string]*schema.Schema{
												"web_schema": {
													Type:         schema.TypeString,
													Optional:     true,
													ValidateFunc: StringInSlice([]string{"http", "https"}, false),
												},
												"web_root": {
													Type:     schema.TypeString,
													Optional: true,
												},
												"web_fqdn": {
													Type:     schema.TypeString,
													Optional: true,
												},
												"web_port": {
													Type:     schema.TypeInt,
													Optional: true,
												},
											},
										},
									},
									"kiali_service_annotations": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"distributed_kiali_access_tokens": {
										Type:     schema.TypeString,
										Computed: true,
									},
									"ram_oauth_config": {
										Type:     schema.TypeList,
										Optional: true,
										MaxItems: 1,
										Elem: &schema.Resource{
											Schema: map[string]*schema.Schema{
												"redirect_uris": {
													Type:     schema.TypeString,
													Optional: true,
												},
											},
										},
									},
									"custom_prometheus_url": {
										Type:     schema.TypeString,
										Computed: true,
										Optional: true,
									},
								},
							},
						},
						"proxy": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"limit_memory": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"request_memory": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"cluster_domain": {
										Type:     schema.TypeString,
										Optional: true,
										Computed: true,
										ForceNew: true,
									},
									"limit_cpu": {
										Type:     schema.TypeString,
										Optional: true,
									},
									"request_cpu": {
										Type:     schema.TypeString,
										Optional: true,
									},
								},
							},
						},
						"include_ip_ranges": {
							Type:     schema.TypeString,
							Optional: true,
							Computed: true,
						},
						"enable_locality_lb": {
							Type:     schema.TypeBool,
							Optional: true,
							ForceNew: true,
						},
						"control_plane_log": {
							Type:     schema.TypeList,
							Optional: true,
							MaxItems: 1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									"project": {
										Type:         schema.TypeString,
										Optional:     true,
										ValidateFunc: StringMatch(regexp.MustCompile("^[\\w.-]+$"), "The name of the SLS Project to which the control plane logs are collected."),
									},
									"log_ttl_in_day": {
										Type:         schema.TypeInt,
										Optional:     true,
										Computed:     true,
										ValidateFunc: IntBetween(0, 365),
									},
									"enabled": {
										Type:     schema.TypeBool,
										Required: true,
									},
								},
							},
						},
						"tracing": {
							Type:     schema.TypeBool,
							Optional: true,
						},
						"customized_zipkin": {
							Type:     schema.TypeBool,
							Optional: true,
						},
					},
				},
			},
			"network": {
				Type:     schema.TypeList,
				Required: true,
				ForceNew: true,
				MaxItems: 1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"vpc_id": {
							Type:     schema.TypeString,
							Required: true,
							ForceNew: true,
						},
						"security_group_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"vswitche_list": {
							Type:     schema.TypeList,
							Required: true,
							ForceNew: true,
							Elem:     &schema.Schema{Type: schema.TypeString},
						},
					},
				},
			},
			"prometheus_url": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"service_mesh_name": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"status": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"tags": tagsSchema(),
			"version": {
				Type:     schema.TypeString,
				Optional: true,
			},
		},
	}
}