From 404731da6b4ae144d54788d1639a33d9443d82bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Fri, 17 Sep 2021 17:28:11 +0800 Subject: [PATCH 1/7] Modified author contact information --- README-CN.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-CN.md b/README-CN.md index aaa92a2..a12b591 100644 --- a/README-CN.md +++ b/README-CN.md @@ -157,7 +157,7 @@ module "redis" { 作者 ------- -Created and maintained by Yi Jincheng(yi785301535@163.com), He Guimin(@xiaozhu36, heguimin36@163.com) +Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com) 许可 ---- diff --git a/README.md b/README.md index 380dc01..ef5da6f 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ If you have not set them yet, please install [aliyun-cli](https://github.com/ali Authors --------- -Created and maintained by Yi Jincheng(yi785301535@163.com), He Guimin(@xiaozhu36, heguimin36@163.com) +Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com) License ---- From 4527d56cc585a6da4732786a745e6cf623ec082a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Thu, 11 Nov 2021 20:31:56 +0800 Subject: [PATCH 2/7] Removes the provider setting and improves the Readme --- README-CN.md | 44 ++++++++++++++++++++++++++++++++++++++++++-- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++++--- main.tf | 8 -------- 3 files changed, 87 insertions(+), 13 deletions(-) diff --git a/README-CN.md b/README-CN.md index a12b591..613ad9c 100644 --- a/README-CN.md +++ b/README-CN.md @@ -14,7 +14,10 @@ terraform-alicloud-redis ## Terraform 版本 -本模板要求使用版本 Terraform 0.12 和阿里云 Provider 1.56.0+。 +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 0.12.0 | +| [alicloud](#requirement\_alicloud) | >= 1.56.0 ## 用法 @@ -152,8 +155,45 @@ module "redis" { 更多模板详见 [Modules](https://github.com/terraform-alicloud-modules/terraform-alicloud-redis/tree/master/modules). ## 注意事项 +本Module从版本v1.9.0开始已经移除掉如下的 provider 的显示设置: +```hcl +provider "alicloud" { + profile = var.profile != "" ? var.profile : null + region = var.region != "" ? var.region : null + skip_region_validation = var.skip_region_validation +} +``` + +如果你依然想在Module中使用这个 provider 配置,你可以在调用Module的时候,指定一个特定的版本,比如 1.8.0: + +```hcl +module "redis" { + source = "alibaba/redis/alicloud" + version = "1.8.0" + region = "cn-hangzhou" + profile = "Your-Profile-Name" + create = true + vpc_name = "my-env-redis" + // ... +} +``` +如果你想对正在使用中的Module升级到 1.9.0 或者更高的版本,那么你可以在模板中显示定义一个系统过Region的provider: +```hcl +provider "alicloud" { + region = "cn-hangzhou" + profile = "Your-Profile-Name" +} +module "redis" { + source = "alibaba/redis/alicloud" + create = true + vpc_name = "my-env-redis" + // ... +} +``` + +定义完provider之后,运行命令 `terraform init` 和 `terraform apply` 来让这个provider生效即可。 -* 本 Module 使用的 AccessKey 和 SecretKey 可以直接从 `profile` 和 `shared_credentials_file` 中获取。如果未设置,可通过下载安装 [aliyun-cli](https://github.com/aliyun/aliyun-cli#installation) 后进行配置。 +更多provider的使用细节,请移步[How to use provider in the module](https://www.terraform.io/docs/language/modules/develop/providers.html#passing-providers-explicitly) 作者 ------- diff --git a/README.md b/README.md index ef5da6f..0c3d4aa 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,10 @@ These types of resources are supported: ## Terraform versions -This module requires Terraform 0.12 and Terraform Provider Alicloud 1.56.0+. +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 0.12.0 | +| [alicloud](#requirement\_alicloud) | >= 1.56.0 Usage ----- @@ -156,10 +159,49 @@ This module provides rich sub-modules to support different Redis version and usa See [more modules](https://github.com/terraform-alicloud-modules/terraform-alicloud-redis/tree/master/modules). ## Notes +From the version v1.9.0, the module has removed the following `provider` setting: -* This module using AccessKey and SecretKey are from `profile` and `shared_credentials_file`. -If you have not set them yet, please install [aliyun-cli](https://github.com/aliyun/aliyun-cli#installation) and configure it. +```hcl +provider "alicloud" { + profile = var.profile != "" ? var.profile : null + region = var.region != "" ? var.region : null + skip_region_validation = var.skip_region_validation +} +``` + +If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.8.0: + +```hcl +module "vpc" { + source = "alibaba/redis/alicloud" + version = "1.8.0" + region = "cn-hangzhou" + profile = "Your-Profile-Name" + + create = true + vpc_name = "my-env-redis" + // ... +} +``` + +If you want to upgrade the module to 1.9.0 or higher in-place, you can define a provider which same region with +previous region: + +```hcl +provider "alicloud" { + region = "cn-hangzhou" + profile = "Your-Profile-Name" +} +module "redis" { + source = "alibaba/redis/alicloud" + create = true + vpc_name = "my-env-redis" + // ... +} +``` +and then run `terraform init` and `terraform apply` to make the defined provider effect to the existing module state. +More details see [How to use provider in the module](https://www.terraform.io/docs/language/modules/develop/providers.html#passing-providers-explicitly) Authors --------- diff --git a/main.tf b/main.tf index 6a70fa3..ee0e818 100644 --- a/main.tf +++ b/main.tf @@ -1,11 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} - locals { this_instance_id = var.existing_instance_id != "" ? var.existing_instance_id : concat(alicloud_kvstore_instance.this.*.id, [""])[0] create_more_resources = var.existing_instance_id != "" || var.create_instance ? true : false From beb0fce98249d1f637883c06ea9fb0f7db709592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Fri, 12 Nov 2021 18:13:48 +0800 Subject: [PATCH 3/7] Removes the provider setting and improves the Readme --- README-CN.md | 46 ++++++++++++----- README.md | 49 +++++++++++++------ modules/account/main.tf | 8 --- modules/account/variables.tf | 8 +-- modules/redis-2.8-communtity-cluster/main.tf | 7 --- .../redis-2.8-communtity-cluster/variables.tf | 8 +-- modules/redis-2.8-communtity-rwsplit/main.tf | 7 --- .../redis-2.8-communtity-rwsplit/variables.tf | 8 +-- modules/redis-2.8-communtity-standard/main.tf | 7 --- .../variables.tf | 8 +-- modules/redis-4.0-communtity-cluster/main.tf | 7 --- .../redis-4.0-communtity-cluster/variables.tf | 8 +-- modules/redis-4.0-communtity-rwsplit/main.tf | 7 --- .../redis-4.0-communtity-rwsplit/variables.tf | 8 +-- modules/redis-4.0-communtity-standard/main.tf | 7 --- .../variables.tf | 8 +-- .../main.tf | 7 --- .../variables.tf | 8 +-- .../main.tf | 7 --- .../variables.tf | 8 +-- modules/redis-5.0-communtity-cluster/main.tf | 7 --- .../redis-5.0-communtity-cluster/variables.tf | 8 +-- modules/redis-5.0-communtity-rwsplit/main.tf | 7 --- .../redis-5.0-communtity-rwsplit/variables.tf | 8 +-- modules/redis-5.0-communtity-standard/main.tf | 7 --- .../variables.tf | 8 +-- .../main.tf | 7 --- .../variables.tf | 8 +-- .../main.tf | 7 --- .../variables.tf | 8 +-- .../main.tf | 7 --- .../variables.tf | 8 +-- variables.tf | 8 +-- 33 files changed, 133 insertions(+), 196 deletions(-) diff --git a/README-CN.md b/README-CN.md index 613ad9c..7d9168f 100644 --- a/README-CN.md +++ b/README-CN.md @@ -155,7 +155,7 @@ module "redis" { 更多模板详见 [Modules](https://github.com/terraform-alicloud-modules/terraform-alicloud-redis/tree/master/modules). ## 注意事项 -本Module从版本v1.9.0开始已经移除掉如下的 provider 的显示设置: +本Module从版本v1.3.0开始已经移除掉如下的 provider 的显示设置: ```hcl provider "alicloud" { profile = var.profile != "" ? var.profile : null @@ -164,30 +164,52 @@ provider "alicloud" { } ``` -如果你依然想在Module中使用这个 provider 配置,你可以在调用Module的时候,指定一个特定的版本,比如 1.8.0: +如果你依然想在Module中使用这个 provider 配置,你可以在调用Module的时候,指定一个特定的版本,比如 1.2.0: ```hcl module "redis" { - source = "alibaba/redis/alicloud" - version = "1.8.0" + source = "terraform-alicloud-modules/redis/alicloud" + version = "1.2.0" region = "cn-hangzhou" profile = "Your-Profile-Name" - create = true - vpc_name = "my-env-redis" - // ... + + alarm_rule_name = "CmsAlarmForRedis" + alarm_rule_statistics = "Average" + alarm_rule_period = 300 + alarm_rule_operator = "<=" } ``` -如果你想对正在使用中的Module升级到 1.9.0 或者更高的版本,那么你可以在模板中显示定义一个系统过Region的provider: +如果你想对正在使用中的Module升级到 1.3.0 或者更高的版本,那么你可以在模板中显示定义一个相同Region的provider: ```hcl provider "alicloud" { region = "cn-hangzhou" profile = "Your-Profile-Name" } module "redis" { - source = "alibaba/redis/alicloud" - create = true - vpc_name = "my-env-redis" - // ... + source = "terraform-alicloud-modules/redis/alicloud" + alarm_rule_name = "CmsAlarmForRedis" + alarm_rule_statistics = "Average" + alarm_rule_period = 300 + alarm_rule_operator = "<=" +} +``` +或者,如果你是多Region部署,你可以利用 `alias` 定义多个 provider,并在Module中显示指定这个provider: + +```hcl +provider "alicloud" { + region = "cn-hangzhou" + profile = "Your-Profile-Name" + alias = "hz" +} +module "redis" { + source = "terraform-alicloud-modules/redis/alicloud" + providers = { + alicloud = alicloud.hz + } + alarm_rule_name = "CmsAlarmForRedis" + alarm_rule_statistics = "Average" + alarm_rule_period = 300 + alarm_rule_operator = "<=" } ``` diff --git a/README.md b/README.md index 0c3d4aa..a13d8dd 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ This module provides rich sub-modules to support different Redis version and usa See [more modules](https://github.com/terraform-alicloud-modules/terraform-alicloud-redis/tree/master/modules). ## Notes -From the version v1.9.0, the module has removed the following `provider` setting: +From the version v1.3.0, the module has removed the following `provider` setting: ```hcl provider "alicloud" { @@ -169,22 +169,23 @@ provider "alicloud" { } ``` -If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.8.0: +If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.2.0: ```hcl -module "vpc" { - source = "alibaba/redis/alicloud" - version = "1.8.0" +module "redis" { + source = "terraform-alicloud-modules/redis/alicloud" + version = "1.2.0" region = "cn-hangzhou" profile = "Your-Profile-Name" - - create = true - vpc_name = "my-env-redis" - // ... + + alarm_rule_name = "CmsAlarmForRedis" + alarm_rule_statistics = "Average" + alarm_rule_period = 300 + alarm_rule_operator = "<=" } ``` -If you want to upgrade the module to 1.9.0 or higher in-place, you can define a provider which same region with +If you want to upgrade the module to 1.3.0 or higher in-place, you can define a provider which same region with previous region: ```hcl @@ -193,10 +194,30 @@ provider "alicloud" { profile = "Your-Profile-Name" } module "redis" { - source = "alibaba/redis/alicloud" - create = true - vpc_name = "my-env-redis" - // ... + source = "terraform-alicloud-modules/redis/alicloud" + alarm_rule_name = "CmsAlarmForRedis" + alarm_rule_statistics = "Average" + alarm_rule_period = 300 + alarm_rule_operator = "<=" +} +``` +or specify an alias provider with a defined region to the module using `providers`: + +```hcl +provider "alicloud" { + region = "cn-hangzhou" + profile = "Your-Profile-Name" + alias = "hz" +} +module "redis" { + source = "terraform-alicloud-modules/redis/alicloud" + providers = { + alicloud = alicloud.hz + } + alarm_rule_name = "CmsAlarmForRedis" + alarm_rule_statistics = "Average" + alarm_rule_period = 300 + alarm_rule_operator = "<=" } ``` diff --git a/modules/account/main.tf b/modules/account/main.tf index 2ac99a0..eba8321 100644 --- a/modules/account/main.tf +++ b/modules/account/main.tf @@ -1,11 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} - resource "alicloud_kvstore_account" "this" { count = var.create_account ? length(var.accounts) : 0 instance_id = var.redis_instance_id diff --git a/modules/account/variables.tf b/modules/account/variables.tf index 8f36f08..ba4d1c0 100644 --- a/modules/account/variables.tf +++ b/modules/account/variables.tf @@ -3,23 +3,23 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } diff --git a/modules/redis-2.8-communtity-cluster/main.tf b/modules/redis-2.8-communtity-cluster/main.tf index 343f6e8..17d9f43 100644 --- a/modules/redis-2.8-communtity-cluster/main.tf +++ b/modules/redis-2.8-communtity-cluster/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "2.8" diff --git a/modules/redis-2.8-communtity-cluster/variables.tf b/modules/redis-2.8-communtity-cluster/variables.tf index 83a2614..a69a04c 100644 --- a/modules/redis-2.8-communtity-cluster/variables.tf +++ b/modules/redis-2.8-communtity-cluster/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-2.8-communtity-rwsplit/main.tf b/modules/redis-2.8-communtity-rwsplit/main.tf index 2afedc6..dc0cc80 100644 --- a/modules/redis-2.8-communtity-rwsplit/main.tf +++ b/modules/redis-2.8-communtity-rwsplit/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "2.8" diff --git a/modules/redis-2.8-communtity-rwsplit/variables.tf b/modules/redis-2.8-communtity-rwsplit/variables.tf index 83a2614..a69a04c 100644 --- a/modules/redis-2.8-communtity-rwsplit/variables.tf +++ b/modules/redis-2.8-communtity-rwsplit/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-2.8-communtity-standard/main.tf b/modules/redis-2.8-communtity-standard/main.tf index 98d7f23..f64df97 100644 --- a/modules/redis-2.8-communtity-standard/main.tf +++ b/modules/redis-2.8-communtity-standard/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "2.8" diff --git a/modules/redis-2.8-communtity-standard/variables.tf b/modules/redis-2.8-communtity-standard/variables.tf index 83a2614..a69a04c 100644 --- a/modules/redis-2.8-communtity-standard/variables.tf +++ b/modules/redis-2.8-communtity-standard/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-4.0-communtity-cluster/main.tf b/modules/redis-4.0-communtity-cluster/main.tf index 017a466..db36b31 100644 --- a/modules/redis-4.0-communtity-cluster/main.tf +++ b/modules/redis-4.0-communtity-cluster/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "4.0" diff --git a/modules/redis-4.0-communtity-cluster/variables.tf b/modules/redis-4.0-communtity-cluster/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-4.0-communtity-cluster/variables.tf +++ b/modules/redis-4.0-communtity-cluster/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-4.0-communtity-rwsplit/main.tf b/modules/redis-4.0-communtity-rwsplit/main.tf index 88899ee..853fad9 100644 --- a/modules/redis-4.0-communtity-rwsplit/main.tf +++ b/modules/redis-4.0-communtity-rwsplit/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "4.0" diff --git a/modules/redis-4.0-communtity-rwsplit/variables.tf b/modules/redis-4.0-communtity-rwsplit/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-4.0-communtity-rwsplit/variables.tf +++ b/modules/redis-4.0-communtity-rwsplit/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-4.0-communtity-standard/main.tf b/modules/redis-4.0-communtity-standard/main.tf index 94b8134..613bd5b 100644 --- a/modules/redis-4.0-communtity-standard/main.tf +++ b/modules/redis-4.0-communtity-standard/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "4.0" diff --git a/modules/redis-4.0-communtity-standard/variables.tf b/modules/redis-4.0-communtity-standard/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-4.0-communtity-standard/variables.tf +++ b/modules/redis-4.0-communtity-standard/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-4.0-enterprise-cluster-hybrid-storage/main.tf b/modules/redis-4.0-enterprise-cluster-hybrid-storage/main.tf index f40f4ca..17482f3 100644 --- a/modules/redis-4.0-enterprise-cluster-hybrid-storage/main.tf +++ b/modules/redis-4.0-enterprise-cluster-hybrid-storage/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "4.0" diff --git a/modules/redis-4.0-enterprise-cluster-hybrid-storage/variables.tf b/modules/redis-4.0-enterprise-cluster-hybrid-storage/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-4.0-enterprise-cluster-hybrid-storage/variables.tf +++ b/modules/redis-4.0-enterprise-cluster-hybrid-storage/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-4.0-enterprise-standard-hybrid-storage/main.tf b/modules/redis-4.0-enterprise-standard-hybrid-storage/main.tf index 4f6a324..d38cdf0 100644 --- a/modules/redis-4.0-enterprise-standard-hybrid-storage/main.tf +++ b/modules/redis-4.0-enterprise-standard-hybrid-storage/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "4.0" diff --git a/modules/redis-4.0-enterprise-standard-hybrid-storage/variables.tf b/modules/redis-4.0-enterprise-standard-hybrid-storage/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-4.0-enterprise-standard-hybrid-storage/variables.tf +++ b/modules/redis-4.0-enterprise-standard-hybrid-storage/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-5.0-communtity-cluster/main.tf b/modules/redis-5.0-communtity-cluster/main.tf index c8dbc45..67a704b 100644 --- a/modules/redis-5.0-communtity-cluster/main.tf +++ b/modules/redis-5.0-communtity-cluster/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "5.0" diff --git a/modules/redis-5.0-communtity-cluster/variables.tf b/modules/redis-5.0-communtity-cluster/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-5.0-communtity-cluster/variables.tf +++ b/modules/redis-5.0-communtity-cluster/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-5.0-communtity-rwsplit/main.tf b/modules/redis-5.0-communtity-rwsplit/main.tf index 7b44110..8012783 100644 --- a/modules/redis-5.0-communtity-rwsplit/main.tf +++ b/modules/redis-5.0-communtity-rwsplit/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "5.0" diff --git a/modules/redis-5.0-communtity-rwsplit/variables.tf b/modules/redis-5.0-communtity-rwsplit/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-5.0-communtity-rwsplit/variables.tf +++ b/modules/redis-5.0-communtity-rwsplit/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-5.0-communtity-standard/main.tf b/modules/redis-5.0-communtity-standard/main.tf index 08160cf..bacba98 100644 --- a/modules/redis-5.0-communtity-standard/main.tf +++ b/modules/redis-5.0-communtity-standard/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "5.0" diff --git a/modules/redis-5.0-communtity-standard/variables.tf b/modules/redis-5.0-communtity-standard/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-5.0-communtity-standard/variables.tf +++ b/modules/redis-5.0-communtity-standard/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-5.0-enterprise-cluster-enhanced-performance/main.tf b/modules/redis-5.0-enterprise-cluster-enhanced-performance/main.tf index 1a79dfe..f567577 100644 --- a/modules/redis-5.0-enterprise-cluster-enhanced-performance/main.tf +++ b/modules/redis-5.0-enterprise-cluster-enhanced-performance/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "5.0" diff --git a/modules/redis-5.0-enterprise-cluster-enhanced-performance/variables.tf b/modules/redis-5.0-enterprise-cluster-enhanced-performance/variables.tf index a2b4e7a..feef307 100644 --- a/modules/redis-5.0-enterprise-cluster-enhanced-performance/variables.tf +++ b/modules/redis-5.0-enterprise-cluster-enhanced-performance/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/main.tf b/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/main.tf index 4b312f4..2d92ccf 100644 --- a/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/main.tf +++ b/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "5.0" diff --git a/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/variables.tf b/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/variables.tf index b15a00b..03815b8 100644 --- a/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/variables.tf +++ b/modules/redis-5.0-enterprise-rwsplit-enhanced-performance-type/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/modules/redis-5.0-enterprise-standard-enhanced-performance-type/main.tf b/modules/redis-5.0-enterprise-standard-enhanced-performance-type/main.tf index cf7bd39..967821f 100644 --- a/modules/redis-5.0-enterprise-standard-enhanced-performance-type/main.tf +++ b/modules/redis-5.0-enterprise-standard-enhanced-performance-type/main.tf @@ -1,10 +1,3 @@ -provider "alicloud" { - profile = var.profile != "" ? var.profile : null - shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation - configuration_source = "terraform-alicloud-modules/redis" -} locals { engine = "Redis" engine_version = "5.0" diff --git a/modules/redis-5.0-enterprise-standard-enhanced-performance-type/variables.tf b/modules/redis-5.0-enterprise-standard-enhanced-performance-type/variables.tf index b15a00b..03815b8 100644 --- a/modules/redis-5.0-enterprise-standard-enhanced-performance-type/variables.tf +++ b/modules/redis-5.0-enterprise-standard-enhanced-performance-type/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } diff --git a/variables.tf b/variables.tf index 1b76b85..ed14339 100644 --- a/variables.tf +++ b/variables.tf @@ -3,22 +3,22 @@ ################# variable "profile" { - description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable." + 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." default = "" } variable "shared_credentials_file" { - 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." + 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." default = "" } variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.3.0)The region used to launch this module resources." default = "" } variable "skip_region_validation" { - 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)." + 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)." type = bool default = false } From 658ce475de51bf9f6044d274f6fffd872833705f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Mon, 15 Nov 2021 17:33:27 +0800 Subject: [PATCH 4/7] Removes the provider setting and improves the Readme --- README-CN.md | 10 ++++++---- README.md | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README-CN.md b/README-CN.md index 7d9168f..4cfc27b 100644 --- a/README-CN.md +++ b/README-CN.md @@ -158,10 +158,12 @@ module "redis" { 本Module从版本v1.3.0开始已经移除掉如下的 provider 的显示设置: ```hcl provider "alicloud" { - profile = var.profile != "" ? var.profile : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation -} + profile = var.profile != "" ? var.profile : null + shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null + region = var.region != "" ? var.region : null + skip_region_validation = var.skip_region_validation + configuration_source = "terraform-alicloud-modules/redis" +} ``` 如果你依然想在Module中使用这个 provider 配置,你可以在调用Module的时候,指定一个特定的版本,比如 1.2.0: diff --git a/README.md b/README.md index a13d8dd..f94adeb 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,12 @@ From the version v1.3.0, the module has removed the following `provider` setting ```hcl provider "alicloud" { - profile = var.profile != "" ? var.profile : null - region = var.region != "" ? var.region : null - skip_region_validation = var.skip_region_validation -} + profile = var.profile != "" ? var.profile : null + shared_credentials_file = var.shared_credentials_file != "" ? var.shared_credentials_file : null + region = var.region != "" ? var.region : null + skip_region_validation = var.skip_region_validation + configuration_source = "terraform-alicloud-modules/redis" +} ``` If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.2.0: From b83024ad33c2948e6d35243141e0dd7c41e0a46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Mon, 15 Nov 2021 19:01:14 +0800 Subject: [PATCH 5/7] Removes the provider setting and improves the Readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f94adeb..44b72d4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ Be careful:Create Account supports redis instances of version 4.0 or above. ```hcl module "redis" { source = "terraform-alicloud-modules/redis/alicloud" - region = "cn-beijing" ################# # Redis Instance ################# @@ -92,7 +91,6 @@ Be careful:Create Account supports redis instances of version 4.0 or above. ```hcl module "redis" { source = "terraform-alicloud-modules/redis/alicloud" - region = "cn-beijing" ################# # Redis Instance ################# From 62407b3ae612eb5492ee317d2519b4bf5cfa26d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Mon, 15 Nov 2021 19:02:13 +0800 Subject: [PATCH 6/7] Removes the provider setting and improves the Readme --- README-CN.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README-CN.md b/README-CN.md index 4cfc27b..40025e8 100644 --- a/README-CN.md +++ b/README-CN.md @@ -26,7 +26,6 @@ terraform-alicloud-redis ```hcl module "redis" { source = "terraform-alicloud-modules/redis/alicloud" - region = "cn-beijing" ################# # Redis Instance ################# @@ -88,7 +87,6 @@ module "redis" { ```hcl module "redis" { source = "terraform-alicloud-modules/redis/alicloud" - region = "cn-beijing" ################# # Redis Instance ################# From 96bb3dab19520fc24cf52c2df56e6cbe4e83c230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Sat, 27 Nov 2021 23:49:22 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=A4=84=E7=90=86=20InvalidCidrBlock.Overl?= =?UTF-8?q?apped=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/complete/main.tf | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 30f8a36..6ff96f7 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -13,23 +13,39 @@ locals { data "alicloud_vpcs" "default" { is_default = true } + +data "alicloud_vswitches" "default" { + zone_id = data.alicloud_zones.default.zones.0.multi_zone_ids.0 + vpc_id = length(data.alicloud_vpcs.default.ids) > 0 ? "${data.alicloud_vpcs.default.ids.0}" : alicloud_vpc.default.0.id +} + +resource "alicloud_vpc" "default" { + count = length(data.alicloud_vpcs.default.ids) > 0 ? 0 : 1 + cidr_block = "172.16.0.0/12" + vpc_name = "test_vpc_007" +} + data "alicloud_zones" "default" { available_resource_creation = "KVStore" multi = true enable_details = true } + data "alicloud_kvstore_instance_classes" "default" { zone_id = data.alicloud_zones.default.zones.0.multi_zone_ids.0 engine = local.engine engine_version = local.engine_version architecture = local.architecture } + resource "alicloud_vswitch" "this" { - name = "redis_vpc" - availability_zone = data.alicloud_zones.default.zones.0.multi_zone_ids.0 - vpc_id = data.alicloud_vpcs.default.vpcs.0.id - cidr_block = cidrsubnet(data.alicloud_vpcs.default.vpcs.0.cidr_block, 4, 10) + count = length(data.alicloud_vswitches.default.ids) > 0 ? 0 : 1 + vswitch_name = "redis_vpc_007" + zone_id = data.alicloud_zones.default.zones.0.multi_zone_ids.0 + vpc_id = length(data.alicloud_vpcs.default.ids) > 0 ? data.alicloud_vpcs.default.vpcs.0.id : alicloud_vpc.default.0.id + cidr_block = "172.16.0.0/24" } + module "redis_example" { source = "../../" region = var.region @@ -44,7 +60,7 @@ module "redis_example" { password = "Yourpwd123456" period = 1 availability_zone = data.alicloud_zones.default.zones.0.multi_zone_ids.0 - vswitch_id = alicloud_vswitch.this.id + vswitch_id = length(data.alicloud_vswitches.default.ids) > 0 ? data.alicloud_vswitches.default.ids.0 : alicloud_vswitch.this.0.id security_ips = ["1.1.1.1", "2.2.2.2", "3.3.3.3"] tags = { Env = "Private"