add config for ecr repo and remote backend

This commit is contained in:
Nana Janashia
2020-12-20 14:42:33 +01:00
parent 165bd326cb
commit 9f96f5fac1
4 changed files with 25 additions and 1 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,5 @@
.idea/*
target
terraform/.terraform/*
terraform/terraform.tfstate
terraform/terraform.tfstate*
terraform/kubeconfig*

9
terraform/ecr-repo.tf Normal file
View File

@@ -0,0 +1,9 @@
resource "aws_ecr_repository" "myapp-repo" {
name = "myapp"
# defaults
image_tag_mutability = "MUTABLE"
image_scanning_configuration {
scan_on_push = true
}
}

View File

@@ -1,3 +1,11 @@
terraform {
backend "s3" {
bucket = "myapp-cluster-bucket"
key = "myapp/state.tfstate"
region = "eu-west-3"
}
}
provider "kubernetes" {
load_config_file = "false"
host = data.aws_eks_cluster.myapp-cluster.endpoint

7
terraform/outputs.tf Normal file
View File

@@ -0,0 +1,7 @@
output repo_url {
value = aws_ecr_repository.myapp-repo.repository_url
}
output cluster_url {
value = module.eks.cluster_endpoint
}