Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Alicloud SDK version to support native profile authentication and remove manual profile handling code #456

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions alicloud-test/tests/alicloud_cas_certificate/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "resource_name" {
# The Cas Certificate region only support cn-hangzhou, ap-south-1, me-east-1, eu-central-1, ap-northeast-1, ap-southeast-2.
variable "alicloud_region" {
type = string
default = "ap-south-1"
default = "cn-hangzhou"
description = "Alicloud region used for the test."
}

Expand Down Expand Up @@ -48,13 +48,13 @@ resource "tls_self_signed_cert" "example" {

# Add a new Certificate.
resource "alicloud_cas_certificate" "named_test_resource" {
name = var.resource_name
cert = tls_self_signed_cert.example.cert_pem
key = tls_private_key.example.private_key_pem
certificate_name = var.resource_name
cert = tls_self_signed_cert.example.cert_pem
key = tls_private_key.example.private_key_pem
}

output "private_key" {
value = replace(tls_private_key.example.private_key_pem, "\n", "\\n")
value = replace(tls_private_key.example.private_key_pem, "\n", "\\n")
sensitive = true
}

Expand Down
2 changes: 1 addition & 1 deletion alicloud-test/tests/alicloud_cms_monitor_host/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "alicloud_cs_managed_kubernetes" "named_test_resource" {
pod_cidr = "172.20.0.0/16"
service_cidr = "172.21.0.0/20"
worker_vswitch_ids = [alicloud_vswitch.named_test_resource.id]
worker_instance_types = ["ecs.c5.large"]
instance_types = ["ecs.c5.large"]
}

output "cluster_id" {
Expand Down
68 changes: 56 additions & 12 deletions alicloud-test/tests/alicloud_cs_kubernetes_cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,65 @@ resource "alicloud_vswitch" "named_test_resource" {
zone_id = "us-east-1b"
}

# resource "alicloud_cs_managed_kubernetes" "named_test_resource" {
# name = var.resource_name
# count = 1
# cluster_spec = "ack.standard"
# is_enterprise_security_group = true
# worker_number = 2
# password = "Hello1234"
# pod_cidr = "172.20.0.0/16"
# service_cidr = "172.21.0.0/20"
# worker_vswitch_ids = [alicloud_vswitch.named_test_resource.id]
# worker_instance_types = ["ecs.c5.large"]
# }

resource "alicloud_cs_managed_kubernetes" "named_test_resource" {
name = var.resource_name
count = 1
cluster_spec = "ack.standard"
is_enterprise_security_group = true
worker_number = 2
password = "Hello1234"
pod_cidr = "172.20.0.0/16"
service_cidr = "172.21.0.0/20"
worker_vswitch_ids = [alicloud_vswitch.named_test_resource.id]
worker_instance_types = ["ecs.c5.large"]
name = var.resource_name
cluster_spec = "ack.pro.small"
# version can not be defined in variables.tf.
# version = "1.26.3-aliyun.1"
worker_vswitch_ids = [alicloud_vswitch.named_test_resource.id]
new_nat_gateway = true
proxy_mode = "ipvs"
service_cidr = "192.168.0.0/16"

addons {
name = "terway-eniip"
}
addons {
name = "csi-plugin"
}
addons {
name = "csi-provisioner"
}
addons {
name = "logtail-ds"
config = jsonencode({
IngressDashboardEnabled = "true"
})
}
addons {
name = "nginx-ingress-controller"
config = jsonencode({
IngressSlbNetworkType = "internet"
})
# to disable install nginx-ingress-controller automatically
# disabled = true
}
addons {
name = "arms-prometheus"
}
addons {
name = "ack-node-problem-detector"
config = jsonencode({
# sls_project_name = "your-sls-project"
})
}
}

output "cluster_id" {
value = alicloud_cs_managed_kubernetes.named_test_resource[0].id
value = alicloud_cs_managed_kubernetes.named_test_resource.id
}

output "resource_name" {
Expand All @@ -62,5 +106,5 @@ output "region" {
}

output "resource_aka" {
value = "arn:acs:cs:${var.alicloud_region}:${data.alicloud_caller_identity.current.account_id}:cluster/${alicloud_cs_managed_kubernetes.named_test_resource[0].id}"
value = "arn:acs:cs:${var.alicloud_region}:${data.alicloud_caller_identity.current.account_id}:cluster/${alicloud_cs_managed_kubernetes.named_test_resource.id}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,59 @@ resource "alicloud_vswitch" "named_test_resource" {
}

resource "alicloud_cs_managed_kubernetes" "named_test_resource" {
name = var.resource_name
count = 1
cluster_spec = "ack.standard"
is_enterprise_security_group = true
worker_number = 3
password = "Hello1234"
pod_cidr = "172.20.0.0/16"
service_cidr = "172.21.0.0/20"
worker_vswitch_ids = [alicloud_vswitch.named_test_resource.id]
worker_instance_types = ["ecs.c5.large"]
name = var.resource_name
cluster_spec = "ack.pro.small"
# version can not be defined in variables.tf.
# version = "1.26.3-aliyun.1"
worker_vswitch_ids = [alicloud_vswitch.named_test_resource.id]
new_nat_gateway = true
proxy_mode = "ipvs"
service_cidr = "192.168.0.0/16"

addons {
name = "terway-eniip"
}
addons {
name = "csi-plugin"
}
addons {
name = "csi-provisioner"
}
addons {
name = "logtail-ds"
config = jsonencode({
IngressDashboardEnabled = "true"
})
}
addons {
name = "nginx-ingress-controller"
config = jsonencode({
IngressSlbNetworkType = "internet"
})
# to disable install nginx-ingress-controller automatically
# disabled = true
}
addons {
name = "arms-prometheus"
}
addons {
name = "ack-node-problem-detector"
config = jsonencode({
# sls_project_name = "your-sls-project"
})
}
}

output "cluster_id" {
value = alicloud_cs_managed_kubernetes.named_test_resource[0].id
value = alicloud_cs_managed_kubernetes.named_test_resource.id
}

output "instance_id" {
value = alicloud_cs_managed_kubernetes.named_test_resource[0].worker_nodes[0].id
value = alicloud_cs_managed_kubernetes.named_test_resource.worker_nodes[0].id
}

output "ip_address" {
value = alicloud_cs_managed_kubernetes.named_test_resource[0].worker_nodes[0].private_ip
value = alicloud_cs_managed_kubernetes.named_test_resource.worker_nodes[0].private_ip
}

output "resource_name" {
Expand Down
2 changes: 1 addition & 1 deletion alicloud-test/tests/alicloud_kms_key/test-get-query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ select
from
alicloud_kms_key
where
key_id = '{{ output.resource_id.value }}';
key_id = '{{ output.resource_id.value }}' and region = '{{ output.region.value }}';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select key_id, key_aliases
from alicloud_kms_key
where key_id = '{{ output.resource_id.value }}';
where key_id = '{{ output.resource_id.value }}' and region = '{{ output.region.value }}';;
4 changes: 4 additions & 0 deletions alicloud-test/tests/alicloud_kms_key/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ output "resource_name" {
value = var.resource_name
}

output "region" {
value = var.alicloud_region
}

output "account_id" {
value = data.alicloud_caller_identity.current.account_id
}
2 changes: 1 addition & 1 deletion alicloud-test/tests/alicloud_vpc_network_acl/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "resource_name" {

variable "alicloud_region" {
type = string
default = "ap-south-1"
default = "us-east-1"
description = "Alicloud region used for the test."
}

Expand Down
2 changes: 1 addition & 1 deletion alicloud-test/tint.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ const _runGraphqlQuery = function (test, query) {
return new Promise((resolve, reject) => {
try {
var queryTmp = _renderToTmp(test, query.query);
var variablesTmp = _renderToTmp(test, query.variables, {});
// var variablesTmp = _renderToTmp(test, query.variables, {});
var expectedTmp = _renderToTmp(test, query.expected);
} catch (e) {
console.log(chalk.red(`Template Error: ${e.sourcePath}`));
Expand Down
3 changes: 3 additions & 0 deletions alicloud/connection_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ type alicloudConfig struct {
SecretKey *string `hcl:"secret_key"`
IgnoreErrorCodes []string `hcl:"ignore_error_codes,optional"`
Profile *string `hcl:"profile"`
AutoRetry *bool `hcl:"auto_retry,optional"`
MaxRetryTime *int `hcl:"max_retry_time,optional"`
Timeout *int `hcl:"timeout,optional"`
}

func ConfigInstance() interface{} {
Expand Down
Loading
Loading