Skip to content

Commit 7d3d49b

Browse files
王超xiaozhu36
authored andcommitted
Removes the provider setting and improves the Readme
1 parent eeeadd6 commit 7d3d49b

File tree

3 files changed

+70
-14
lines changed

3 files changed

+70
-14
lines changed

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,72 @@ If you want to store kube config and other certificates after the cluster create
154154
155155
Terraform version
156156
-----------------
157-
Terraform version 0.12.0 or newer and Provider version 1.77.0 or newer are required for this example to work.
157+
| Name | Version |
158+
|------|---------|
159+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.0 |
160+
| <a name="requirement_alicloud"></a> [alicloud](#requirement\_alicloud) | >= 1.56.0
161+
162+
## Notes
163+
From the version v1.5.0, the module has removed the following `provider` setting:
164+
165+
```hcl
166+
provider "alicloud" {
167+
profile = var.profile != "" ? var.profile : null
168+
region = var.region != "" ? var.region : null
169+
skip_region_validation = var.skip_region_validation
170+
}
171+
```
172+
173+
If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.4.0:
174+
175+
```hcl
176+
module "managed-kubernetes" {
177+
source = "terraform-alicloud-modules/managed-kubernetes/alicloud"
178+
version = "1.4.0"
179+
region = "cn-hangzhou"
180+
profile = "Your-Profile-Name"
181+
k8s_name_prefix = "my-managed-k8s-with-new-vpc"
182+
new_vpc = true
183+
vpc_cidr = "192.168.0.0/16"
184+
}
185+
```
186+
187+
If you want to upgrade the module to 1.5.0 or higher in-place, you can define a provider which same region with
188+
previous region:
189+
190+
```hcl
191+
provider "alicloud" {
192+
region = "cn-hangzhou"
193+
profile = "Your-Profile-Name"
194+
}
195+
module "managed-kubernetes" {
196+
source = "terraform-alicloud-modules/managed-kubernetes/alicloud"
197+
k8s_name_prefix = "my-managed-k8s-with-new-vpc"
198+
new_vpc = true
199+
vpc_cidr = "192.168.0.0/16"
200+
}
201+
```
202+
or specify an alias provider with a defined region to the module using `providers`:
203+
204+
```hcl
205+
provider "alicloud" {
206+
region = "cn-hangzhou"
207+
profile = "Your-Profile-Name"
208+
alias = "hz"
209+
}
210+
module "managed-kubernetes" {
211+
source = "terraform-alicloud-modules/managed-kubernetes/alicloud"
212+
providers = {
213+
alicloud = alicloud.hz
214+
}
215+
k8s_name_prefix = "my-managed-k8s-with-new-vpc"
216+
new_vpc = true
217+
vpc_cidr = "192.168.0.0/16"
218+
}
219+
```
220+
221+
and then run `terraform init` and `terraform apply` to make the defined provider effect to the existing module state.
222+
More details see [How to use provider in the module](https://www.terraform.io/docs/language/modules/develop/providers.html#passing-providers-explicitly)
158223

159224
Authors
160225
-------

main.tf

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
// Provider specific configs
2-
provider "alicloud" {
3-
profile = var.profile != "" ? var.profile : null
4-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
5-
region = var.region != "" ? var.region : null
6-
skip_region_validation = var.skip_region_validation
7-
configuration_source = "terraform-alicloud-modules/managed-kubernetes"
8-
}
9-
101
resource "alicloud_cs_managed_kubernetes" "this" {
112
count = length(local.vswitch_ids) > 0 ? 1 : 0
123
name = local.k8s_name

variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
//Autoscaling group
22
variable "region" {
3-
description = "The region ID used to launch this module resources. If not set, it will be sourced from followed by ALICLOUD_REGION environment variable and profile."
3+
description = "(Deprecated from version 1.5.0)The region ID used to launch this module resources. If not set, it will be sourced from followed by ALICLOUD_REGION environment variable and profile."
44
type = string
55
default = ""
66
}
77

88
variable "profile" {
9-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
9+
description = "(Deprecated from version 1.5.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
1010
type = string
1111
default = ""
1212
}
1313
variable "shared_credentials_file" {
14-
description = "This is the path to the shared credentials file. If this is not set and a profile is specified, $HOME/.aliyun/config.json will be used."
14+
description = "(Deprecated from version 1.5.0)This is the path to the shared credentials file. If this is not set and a profile is specified, $HOME/.aliyun/config.json will be used."
1515
type = string
1616
default = ""
1717
}
1818

1919
variable "skip_region_validation" {
20-
description = "Skip static validation of region ID. Used by users of alternative AlibabaCloud-like APIs or users w/ access to regions that are not public (yet)."
20+
description = "(Deprecated from version 1.5.0)Skip static validation of region ID. Used by users of alternative AlibabaCloud-like APIs or users w/ access to regions that are not public (yet)."
2121
type = bool
2222
default = false
2323
}

0 commit comments

Comments
 (0)