From a4b4eb7db61a4b0cf64dccf5080387c29d2c9296 Mon Sep 17 00:00:00 2001 From: liuyuan <709503583@qq.com> Date: Wed, 24 Nov 2021 15:51:35 +0800 Subject: [PATCH] Removes the provider setting and improves the Readme --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++- main.tf | 6 ----- variables.tf | 2 +- 3 files changed, 69 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a862946..8702448 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,76 @@ You can use this in your terraform template with the following steps. |------|-------------| | instance_ids | the IDs of Elasticsearch instance. | +## Notes +From the version v1.2.0, the module has removed the following `provider` setting: + +```hcl +provider "alicloud" { + version = ">=1.56.0" + region = var.region != "" ? var.region : null + configuration_source = "terraform-alicloud-modules/elasticsearch-instance" +} +``` + +If you still want to use the `provider` setting to apply this module, you can specify a supported version, like 1.1.0: + +```hcl +module "instance" { + source = "terraform-alicloud-modules/elasticsearch-instance/alicloud" + version = "1.1.0" + region = "cn-beijing" + password = "Your password" + data_node_amount = "2" + // ... +} +``` + +If you want to upgrade the module to 1.2.0 or higher in-place, you can define a provider which same region with +previous region: + +```hcl +provider "alicloud" { + region = "cn-beijing" +} +module "instance" { + source = "terraform-alicloud-modules/elasticsearch-instance/alicloud" + password = "Your password" + data_node_amount = "2" + // ... +} +``` +or specify an alias provider with a defined region to the module using `providers`: + +```hcl +provider "alicloud" { + region = "cn-beijing" + alias = "bj" +} +module "instance" { + source = "terraform-alicloud-modules/elasticsearch-instance/alicloud" + providers = { + alicloud = alicloud.bj + } + password = "Your password" + data_node_amount = "2" + // ... +} +``` + +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) + +## Terraform versions + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 0.12.0 | +| [alicloud](#requirement\_alicloud) | >= 1.56.0 | + Authors ------- -Created and maintained by Guangfan Qu(@guangfanqu guangfan.qu@gmail.com) +Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com) Reference --------- diff --git a/main.tf b/main.tf index d465f4f..ba26895 100644 --- a/main.tf +++ b/main.tf @@ -1,9 +1,3 @@ -provider "alicloud" { - version = ">=1.56.0" - region = var.region != "" ? var.region : null - configuration_source = "terraform-alicloud-modules/elasticsearch-instance" -} - ######################### # Elasticsearch instance ######################### diff --git a/variables.tf b/variables.tf index b1c9a19..d252675 100644 --- a/variables.tf +++ b/variables.tf @@ -1,5 +1,5 @@ variable "region" { - description = "The region used to launch this module resources." + description = "(Deprecated from version 1.2.0) The region used to launch this module resources." default = "" }