alibabacloud-automation / terraform-alicloud-vpc

Terraform module which creates VPC and Subnet resources on Alibaba Cloud.
https://registry.terraform.io/modules/alibaba/vpc/alicloud/latest
MIT License
16 stars 38 forks source link

Alicloud Terraform always creating VPC in Beijing region #42

Closed armon8-ingka closed 11 months ago

armon8-ingka commented 11 months ago

Hi Team,

Whenever I am trying to create a VPC no matter what region I mention in the provider it is creating the VPC in Beijing region. I am trying to create the VPC in Shanghai region but it creates it in Beijing region.

I tried creating alicloud_vpc resource but it is same. I also tried to create using existing module "vpc" from alicloud but still same.

Following is what I tried.

With alicloud_vpc resource :

provider "alicloud" {
  region     = "cn-shanghai"
}

resource "alicloud_vpc" "vpc" {
  description       = "Default VPC"
  cidr_block        = "10.0.0.0/8"
  vpc_name          = "test-vpc"
  enable_ipv6       = false
  resource_group_id = var.resource_group_id
}

data "alicloud_regions" "current_region_ds" {
  current = true
}

the output for current region shows : current_region_id = "cn-shanghai"

tried this way also but still same result:


module "vpc" {
  source  = "alibaba/vpc/alicloud"
  region = "cn-shanghai"
  create            = true
  vpc_name          = "my-env-vpc"
  vpc_cidr          = "10.0.0.0/8"
  resource_group_id = "rg-acfmwvvtg5o****"

}
armon8-ingka commented 11 months ago

The provider needs to be mentioned in all the mentioned modules separately. That fixed the issue, thanks.