What is the meaning of message given in details from terraform?

Viewed 31

What is meaning of below message?

Warning: Version constraints inside provider configuration blocks are deprecated
│
│   on revision.tf line 5, in provider "aws":
│    5:   version    = ">=2.10,<=2.30"
│
│ Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now deprecated and will be removed  
│ in a future version of Terraform. To silence this warning, move the provider version constraint into the required_providers block.
1 Answers

You are using version 0.12 provider syntax in version 0.13 syntax

version 0.12 syntax

# Configure the AWS Provider
provider "aws" {
  version = "~> 4.0"
  region  = "us-east-1"
}

# Create a VPC
resource "aws_vpc" "example" {
  cidr_block = "10.0.0.0/16"
}

But in version 0.13 and later, you need to move version present in privider block into required_providers

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

# Configure the AWS Provider
provider "aws" {
  region = "us-east-1"
}

# Create a VPC
resource "aws_vpc" "example" {
  cidr_block = "10.0.0.0/16"
}
Related