Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onnimonni/terraform-ecr-docker-build-module
https://github.com/onnimonni/terraform-ecr-docker-build-module
aws-ecr docker terraform
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/onnimonni/terraform-ecr-docker-build-module
- Owner: onnimonni
- License: mit
- Created: 2018-04-21T22:24:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T04:49:33.000Z (almost 3 years ago)
- Last Synced: 2023-08-05T09:56:27.342Z (over 1 year ago)
- Topics: aws-ecr, docker, terraform
- Language: Shell
- Size: 13.7 KB
- Stars: 23
- Watchers: 1
- Forks: 25
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```hcl
# 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](https://github.com/onnimonni)