All Projects → onnimonni → terraform-ecr-docker-build-module

onnimonni / terraform-ecr-docker-build-module

Licence: MIT license
No description or website provided.

Programming Languages

shell
77523 projects
HCL
1544 projects

Projects that are alternatives of or similar to terraform-ecr-docker-build-module

e9-cloudformation-docker-ecs
Docker on Amazon ECS with AWS Fargate using CloudFormation. https://devteds.com/episodes/9-docker-on-amazon-ecs-using-cloudformation
Stars: ✭ 78 (+271.43%)
Mutual labels:  aws-ecr
sbt-ecr
An SBT plugin for managing Docker images within Amazon ECR.
Stars: ✭ 52 (+147.62%)
Mutual labels:  aws-ecr
ecr-buildkite-plugin
🔐 Login to an AWS ECR registry
Stars: ✭ 24 (+14.29%)
Mutual labels:  aws-ecr

Terraform Docker build and ECR push module

This is a quite hacky module which contains few bash scripts which build docker images locally and pushes them into AWS ECR using aws cli.

Requirements

Terraform version needs to be 0.12 or newer.

You need to have following programs installed in your $PATH:

  • bash
  • md5sum or md5
  • aws
  • docker

Note: Docker server needs to be running so that we can actually build images

AWS Credentials

You need to provide AWS credentials as env or profile for aws-cli for this module to work properly

Example

# Create ECR repository
resource "aws_ecr_repository" "test_service" {
  name = "example-service-name"
}

# Build Docker image and push to ECR from folder: ./example-service-directory
module "ecr_docker_build" {
  source = "github.com/onnimonni/terraform-ecr-docker-build-module"

  # Absolute path into the service which needs to be build
  dockerfile_folder = "${path.module}/example-service-directory"

  # Tag for the builded Docker image (Defaults to 'latest')
  docker_image_tag = "development"
  
  # The region which we will log into with aws-cli
  aws_region = "eu-west-1"

  # ECR repository where we can push
  ecr_repository_url = "${aws_ecr_repository.test_service.repository_url}"
}

License

MIT

Author

Onni Hakala

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].