Skip to content

Commit

Permalink
Add st-alicloud_ess_clb_default_server_group_attachment resource. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
chihong99 authored Nov 3, 2023
1 parent e95ec9c commit aa1acd8
Show file tree
Hide file tree
Showing 7 changed files with 456 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ scenario. The reason behind every resources and data sources are stated as below
This resource is designed to create auto scaling rules for AliCloud E-MapReduce cluster as the provider's resource [*alicloud_emrv2_cluster*](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/emrv2_cluster)
does not provide the option to create auto scaling rules for nodes. (Note: Only task nodes are eligible for auto scaling)
- **st-alicloud_ess_clb_default_server_group_attachment**
This resource is designed to attach an auto scaling group (ESS) with a list of load balancers (CLB) default server group.
### Data Sources
- **st-alicloud_ddoscoo_domain_resources**
Expand Down
19 changes: 19 additions & 0 deletions alicloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
alicloudEmrClient "github.com/alibabacloud-go/emr-20210320/client"
alicloudRamClient "github.com/alibabacloud-go/ram-20150501/v2/client"
alicloudSlbClient "github.com/alibabacloud-go/slb-20140515/v4/client"
alicloudEssClient "github.com/alibabacloud-go/ess-20220222/v2/client"

"github.com/alibabacloud-go/tea/tea"
)
Expand All @@ -39,6 +40,7 @@ type alicloudClients struct {
adbClient *alicloudAdbClient.Client
emrClient *alicloudEmrClient.Client
csClient *alicloudCsClient.Client
essClient *alicloudEssClient.Client
}

// Ensure the implementation satisfies the expected interfaces
Expand Down Expand Up @@ -341,6 +343,21 @@ func (p *alicloudProvider) Configure(ctx context.Context, req provider.Configure
return
}

// AliCloud ESS Client
essClientConfig := clientCredentialsConfig
essClientConfig.Endpoint = tea.String("ess.aliyuncs.com")
essClient, err := alicloudEssClient.NewClient(essClientConfig)

if err != nil {
resp.Diagnostics.AddError(
"Unable to Create AliCloud ESS API Client",
"An unexpected error occurred when creating the AliCloud ESS API client. "+
"If the error is not clear, please contact the provider developers.\n\n"+
"AliCloud ESS Client Error: "+err.Error(),
)
return
}

// AliCloud clients wrapper
alicloudClients := alicloudClients{
baseClient: baseClient,
Expand All @@ -353,6 +370,7 @@ func (p *alicloudProvider) Configure(ctx context.Context, req provider.Configure
adbClient: adbClient,
emrClient: emrClient,
csClient: csClient,
essClient: essClient,
}

resp.DataSourceData = alicloudClients
Expand Down Expand Up @@ -383,5 +401,6 @@ func (p *alicloudProvider) Resources(_ context.Context) []func() resource.Resour
NewAliadbResourceGroupBindResource,
NewEmrMetricAutoScalingRulesResource,
NewDdosCooWebAIProtectConfigResource,
NewEssClbDefaultServerGroupAttachmentResource,
}
}
Loading

0 comments on commit aa1acd8

Please sign in to comment.