Skip to content

Instantly share code, notes, and snippets.

@AndrewBestbier
Created March 10, 2020 15:02
Show Gist options
  • Select an option

  • Save AndrewBestbier/9387e669b1c62e79269d71566f6ce2c0 to your computer and use it in GitHub Desktop.

Select an option

Save AndrewBestbier/9387e669b1c62e79269d71566f6ce2c0 to your computer and use it in GitHub Desktop.
provider "aws" {
version = "~> 2.0"
region = "eu-west-2" # Setting my region to London. Use your own region here
}
resource "aws_ecr_repository" "my_first_ecr_repo" {
name = "my-first-ecr-repo" # Naming my repository
}
@ptorru
Copy link

ptorru commented Nov 23, 2022

Hi there, I was following your tutorial in Medium, this may need refreshing for newer versions of TF. I got the following error:

Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 2.0"...
╷
│ Warning: Version constraints inside provider configuration blocks are deprecated
│
│   on main.tf line 2, in provider "aws":
│    2:   version = "~> 2.0"
│
│ 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.
╵

╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/aws v2.70.1 does not have a package available for your
│ current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all
│ platforms. Other versions of this provider may have different platforms supported.

I think this will also remove any errors for newer macs:

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

  required_version = ">= 1.2.0"
}

provider "aws" {
  region = "eu-west-2" # Setting my region to London. Use your own region here
}

resource "aws_ecr_repository" "aws_with_tf_ecr_repo" {
  name = "aws-with-tf-ecr-repo" # Naming my repository
}

I hope this is useful! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment