Skip to content

Commit c85716f

Browse files
王超xiaozhu36
authored andcommitted
Removes the provider setting and improves the Readme
1 parent 23ee279 commit c85716f

File tree

33 files changed

+133
-196
lines changed

33 files changed

+133
-196
lines changed

README-CN.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ module "redis" {
155155
更多模板详见 [Modules](https://github.com/terraform-alicloud-modules/terraform-alicloud-redis/tree/master/modules).
156156

157157
## 注意事项
158-
本Module从版本v1.9.0开始已经移除掉如下的 provider 的显示设置:
158+
本Module从版本v1.3.0开始已经移除掉如下的 provider 的显示设置:
159159
```hcl
160160
provider "alicloud" {
161161
profile = var.profile != "" ? var.profile : null
@@ -164,30 +164,52 @@ provider "alicloud" {
164164
}
165165
```
166166

167-
如果你依然想在Module中使用这个 provider 配置,你可以在调用Module的时候,指定一个特定的版本,比如 1.8.0:
167+
如果你依然想在Module中使用这个 provider 配置,你可以在调用Module的时候,指定一个特定的版本,比如 1.2.0:
168168

169169
```hcl
170170
module "redis" {
171-
source = "alibaba/redis/alicloud"
172-
version = "1.8.0"
171+
source = "terraform-alicloud-modules/redis/alicloud"
172+
version = "1.2.0"
173173
region = "cn-hangzhou"
174174
profile = "Your-Profile-Name"
175-
create = true
176-
vpc_name = "my-env-redis"
177-
// ...
175+
176+
alarm_rule_name = "CmsAlarmForRedis"
177+
alarm_rule_statistics = "Average"
178+
alarm_rule_period = 300
179+
alarm_rule_operator = "<="
178180
}
179181
```
180-
如果你想对正在使用中的Module升级到 1.9.0 或者更高的版本,那么你可以在模板中显示定义一个系统过Region的provider
182+
如果你想对正在使用中的Module升级到 1.3.0 或者更高的版本,那么你可以在模板中显示定义一个相同Region的provider
181183
```hcl
182184
provider "alicloud" {
183185
region = "cn-hangzhou"
184186
profile = "Your-Profile-Name"
185187
}
186188
module "redis" {
187-
source = "alibaba/redis/alicloud"
188-
create = true
189-
vpc_name = "my-env-redis"
190-
// ...
189+
source = "terraform-alicloud-modules/redis/alicloud"
190+
alarm_rule_name = "CmsAlarmForRedis"
191+
alarm_rule_statistics = "Average"
192+
alarm_rule_period = 300
193+
alarm_rule_operator = "<="
194+
}
195+
```
196+
或者,如果你是多Region部署,你可以利用 `alias` 定义多个 provider,并在Module中显示指定这个provider:
197+
198+
```hcl
199+
provider "alicloud" {
200+
region = "cn-hangzhou"
201+
profile = "Your-Profile-Name"
202+
alias = "hz"
203+
}
204+
module "redis" {
205+
source = "terraform-alicloud-modules/redis/alicloud"
206+
providers = {
207+
alicloud = alicloud.hz
208+
}
209+
alarm_rule_name = "CmsAlarmForRedis"
210+
alarm_rule_statistics = "Average"
211+
alarm_rule_period = 300
212+
alarm_rule_operator = "<="
191213
}
192214
```
193215

README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ This module provides rich sub-modules to support different Redis version and usa
159159
See [more modules](https://github.com/terraform-alicloud-modules/terraform-alicloud-redis/tree/master/modules).
160160

161161
## Notes
162-
From the version v1.9.0, the module has removed the following `provider` setting:
162+
From the version v1.3.0, the module has removed the following `provider` setting:
163163

164164
```hcl
165165
provider "alicloud" {
@@ -169,22 +169,23 @@ provider "alicloud" {
169169
}
170170
```
171171

172-
If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.8.0:
172+
If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.2.0:
173173

174174
```hcl
175-
module "vpc" {
176-
source = "alibaba/redis/alicloud"
177-
version = "1.8.0"
175+
module "redis" {
176+
source = "terraform-alicloud-modules/redis/alicloud"
177+
version = "1.2.0"
178178
region = "cn-hangzhou"
179179
profile = "Your-Profile-Name"
180-
181-
create = true
182-
vpc_name = "my-env-redis"
183-
// ...
180+
181+
alarm_rule_name = "CmsAlarmForRedis"
182+
alarm_rule_statistics = "Average"
183+
alarm_rule_period = 300
184+
alarm_rule_operator = "<="
184185
}
185186
```
186187

187-
If you want to upgrade the module to 1.9.0 or higher in-place, you can define a provider which same region with
188+
If you want to upgrade the module to 1.3.0 or higher in-place, you can define a provider which same region with
188189
previous region:
189190

190191
```hcl
@@ -193,10 +194,30 @@ provider "alicloud" {
193194
profile = "Your-Profile-Name"
194195
}
195196
module "redis" {
196-
source = "alibaba/redis/alicloud"
197-
create = true
198-
vpc_name = "my-env-redis"
199-
// ...
197+
source = "terraform-alicloud-modules/redis/alicloud"
198+
alarm_rule_name = "CmsAlarmForRedis"
199+
alarm_rule_statistics = "Average"
200+
alarm_rule_period = 300
201+
alarm_rule_operator = "<="
202+
}
203+
```
204+
or specify an alias provider with a defined region to the module using `providers`:
205+
206+
```hcl
207+
provider "alicloud" {
208+
region = "cn-hangzhou"
209+
profile = "Your-Profile-Name"
210+
alias = "hz"
211+
}
212+
module "redis" {
213+
source = "terraform-alicloud-modules/redis/alicloud"
214+
providers = {
215+
alicloud = alicloud.hz
216+
}
217+
alarm_rule_name = "CmsAlarmForRedis"
218+
alarm_rule_statistics = "Average"
219+
alarm_rule_period = 300
220+
alarm_rule_operator = "<="
200221
}
201222
```
202223

modules/account/main.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
8-
91
resource "alicloud_kvstore_account" "this" {
102
count = var.create_account ? length(var.accounts) : 0
113
instance_id = var.redis_instance_id

modules/account/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
#################
44

55
variable "profile" {
6-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
6+
description = "(Deprecated from version 1.3.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
77
default = ""
88
}
99

1010
variable "shared_credentials_file" {
11-
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."
11+
description = "(Deprecated from version 1.3.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."
1212
default = ""
1313
}
1414

1515
variable "skip_region_validation" {
16-
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)."
16+
description = "(Deprecated from version 1.3.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)."
1717
type = bool
1818
default = false
1919
}
2020

2121
variable "region" {
22-
description = "The region used to launch this module resources."
22+
description = "(Deprecated from version 1.3.0)The region used to launch this module resources."
2323
default = ""
2424
}
2525

modules/redis-2.8-communtity-cluster/main.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
81
locals {
92
engine = "Redis"
103
engine_version = "2.8"

modules/redis-2.8-communtity-cluster/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
#################
44

55
variable "profile" {
6-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
6+
description = "(Deprecated from version 1.3.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
77
default = ""
88
}
99

1010
variable "shared_credentials_file" {
11-
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."
11+
description = "(Deprecated from version 1.3.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."
1212
default = ""
1313
}
1414

1515
variable "region" {
16-
description = "The region used to launch this module resources."
16+
description = "(Deprecated from version 1.3.0)The region used to launch this module resources."
1717
default = ""
1818
}
1919

2020
variable "skip_region_validation" {
21-
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)."
21+
description = "(Deprecated from version 1.3.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)."
2222
type = bool
2323
default = false
2424
}

modules/redis-2.8-communtity-rwsplit/main.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
81
locals {
92
engine = "Redis"
103
engine_version = "2.8"

modules/redis-2.8-communtity-rwsplit/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
#################
44

55
variable "profile" {
6-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
6+
description = "(Deprecated from version 1.3.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
77
default = ""
88
}
99

1010
variable "shared_credentials_file" {
11-
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."
11+
description = "(Deprecated from version 1.3.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."
1212
default = ""
1313
}
1414

1515
variable "region" {
16-
description = "The region used to launch this module resources."
16+
description = "(Deprecated from version 1.3.0)The region used to launch this module resources."
1717
default = ""
1818
}
1919

2020
variable "skip_region_validation" {
21-
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)."
21+
description = "(Deprecated from version 1.3.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)."
2222
type = bool
2323
default = false
2424
}

modules/redis-2.8-communtity-standard/main.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
81
locals {
92
engine = "Redis"
103
engine_version = "2.8"

modules/redis-2.8-communtity-standard/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
#################
44

55
variable "profile" {
6-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
6+
description = "(Deprecated from version 1.3.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
77
default = ""
88
}
99

1010
variable "shared_credentials_file" {
11-
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."
11+
description = "(Deprecated from version 1.3.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."
1212
default = ""
1313
}
1414

1515
variable "region" {
16-
description = "The region used to launch this module resources."
16+
description = "(Deprecated from version 1.3.0)The region used to launch this module resources."
1717
default = ""
1818
}
1919

2020
variable "skip_region_validation" {
21-
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)."
21+
description = "(Deprecated from version 1.3.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)."
2222
type = bool
2323
default = false
2424
}

modules/redis-4.0-communtity-cluster/main.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
81
locals {
92
engine = "Redis"
103
engine_version = "4.0"

modules/redis-4.0-communtity-cluster/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
#################
44

55
variable "profile" {
6-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
6+
description = "(Deprecated from version 1.3.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
77
default = ""
88
}
99

1010
variable "shared_credentials_file" {
11-
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."
11+
description = "(Deprecated from version 1.3.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."
1212
default = ""
1313
}
1414

1515
variable "region" {
16-
description = "The region used to launch this module resources."
16+
description = "(Deprecated from version 1.3.0)The region used to launch this module resources."
1717
default = ""
1818
}
1919

2020
variable "skip_region_validation" {
21-
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)."
21+
description = "(Deprecated from version 1.3.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)."
2222
type = bool
2323
default = false
2424
}

modules/redis-4.0-communtity-rwsplit/main.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
81
locals {
92
engine = "Redis"
103
engine_version = "4.0"

modules/redis-4.0-communtity-rwsplit/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
#################
44

55
variable "profile" {
6-
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
6+
description = "(Deprecated from version 1.3.0)The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
77
default = ""
88
}
99

1010
variable "shared_credentials_file" {
11-
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."
11+
description = "(Deprecated from version 1.3.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."
1212
default = ""
1313
}
1414

1515
variable "region" {
16-
description = "The region used to launch this module resources."
16+
description = "(Deprecated from version 1.3.0)The region used to launch this module resources."
1717
default = ""
1818
}
1919

2020
variable "skip_region_validation" {
21-
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)."
21+
description = "(Deprecated from version 1.3.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)."
2222
type = bool
2323
default = false
2424
}

modules/redis-4.0-communtity-standard/main.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
provider "alicloud" {
2-
profile = var.profile != "" ? var.profile : null
3-
shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null
4-
region = var.region != "" ? var.region : null
5-
skip_region_validation = var.skip_region_validation
6-
configuration_source = "terraform-alicloud-modules/redis"
7-
}
81
locals {
92
engine = "Redis"
103
engine_version = "4.0"

0 commit comments

Comments
 (0)