user0509
user0509

Reputation: 21

Terraform giving error for new AWS new regions (af-south-1,eu-south-1)

I am facing issue while creating resources in aws account using terraform script (0.11 version)

changes in main.tf file =>

provider "aws" {
alias = "af-south-1"
region = "af-south-1"
}

module "af-south-1-module" {
  source = "./modules"
  providers = {
    aws = "aws.af-south-1"
  }
 aws_region= "af-south-1"
 should_run= "${contains(var.region_list, "af-south-1")}"
 customer_id= "${var.customer_id}"
 dns_prefix= "${var.dns_prefix_flowlogs}"
 iam_for_lambda_arn= "${aws_iam_role.iam_for_lambda.arn}"
 aws_account_id= "${local.aws_account_id}"
 iam_for_vpc_flow_arn= "${aws_iam_role.avid_vpc_flow_role.arn}"
 }

changes in vars.tf file =>

    variable "region_list" {
    type = "list"
    default = ["us-west-1",
    "us-west-2",
    "us-east-1",
    "eu-north-1",
    "af-south-1"]
   }

I am getting following error while running "terraform apply" command

Error: Error refreshing state: 2 error(s) occurred:

Note:

  1. Region is enabled in AWS account
  2. Same code is working for other regions in region_list.

Upvotes: 2

Views: 1825

Answers (1)

Khalid Waseem
Khalid Waseem

Reputation: 119

You are getting error for the region "eu-south-1" which I did not see in your code. I will suggest you to check the region specified in your .aws/credentials file in your system. Also check your aws provider version, terraform 0.11 doesn't support higher versions as it is supported in 0.12 version. Some time template verssion difference also creates issues to terraform to work.

Upvotes: 1

Related Questions