Skip to content

Commit

Permalink
Merge pull request #6 from rearc/mwkaufman/codebuild_image
Browse files Browse the repository at this point in the history
Parameterize repo_path
  • Loading branch information
mwkaufman authored Oct 23, 2020
2 parents 1fc4bdb + 4e8ac90 commit e579fd0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
41 changes: 36 additions & 5 deletions codebuild.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ resource "aws_codebuild_project" "build" {
value = "${jsonencode(var.task_role_arn)}"
}

environment_variable {
name = "REPO_PATH"
value = "${jsonencode(var.repo_path)}"
}

}

logs_config {
Expand All @@ -87,6 +92,7 @@ resource "aws_codebuild_project" "build" {

source {
type = "CODEPIPELINE"
buildspec = "${var.repo_path}/buildspec.yml"
}

vpc_config {
Expand Down Expand Up @@ -162,6 +168,11 @@ resource "aws_codebuild_project" "e2e_tests" {
value = "${jsonencode(var.task_role_arn)}"
}

environment_variable {
name = "REPO_PATH"
value = "${jsonencode(var.repo_path)}"
}

}

logs_config {
Expand All @@ -173,7 +184,7 @@ resource "aws_codebuild_project" "e2e_tests" {

source {
type = "CODEPIPELINE"
buildspec = "buildspec-cypress.yml"
buildspec = "${var.repo_path}/buildspec-cypress.yml"
}

vpc_config {
Expand Down Expand Up @@ -249,6 +260,11 @@ resource "aws_codebuild_project" "unit_tests" {
value = "${jsonencode(var.task_role_arn)}"
}

environment_variable {
name = "REPO_PATH"
value = "${jsonencode(var.repo_path)}"
}

}

logs_config {
Expand All @@ -260,7 +276,7 @@ resource "aws_codebuild_project" "unit_tests" {

source {
type = "CODEPIPELINE"
buildspec = "buildspec-rspec.yml"
buildspec = "${var.repo_path}/buildspec-rspec.yml"
}

vpc_config {
Expand Down Expand Up @@ -336,6 +352,11 @@ resource "aws_codebuild_project" "publish" {
value = "${jsonencode(var.task_role_arn)}"
}

environment_variable {
name = "REPO_PATH"
value = "${jsonencode(var.repo_path)}"
}

}

logs_config {
Expand All @@ -347,7 +368,7 @@ resource "aws_codebuild_project" "publish" {

source {
type = "CODEPIPELINE"
buildspec = "buildspec-publish.yml"
buildspec = "${var.repo_path}/buildspec-publish.yml"
}

vpc_config {
Expand Down Expand Up @@ -423,6 +444,11 @@ resource "aws_codebuild_project" "db_migrate" {
value = "${jsonencode(var.task_role_arn)}"
}

environment_variable {
name = "REPO_PATH"
value = "${jsonencode(var.repo_path)}"
}

}

logs_config {
Expand All @@ -434,7 +460,7 @@ resource "aws_codebuild_project" "db_migrate" {

source {
type = "CODEPIPELINE"
buildspec = "buildspec-db_migrate.yml"
buildspec = "${var.repo_path}/buildspec-db_migrate.yml"
}

vpc_config {
Expand Down Expand Up @@ -510,6 +536,11 @@ resource "aws_codebuild_project" "update_service" {
value = "${jsonencode(var.task_role_arn)}"
}

environment_variable {
name = "REPO_PATH"
value = "${jsonencode(var.repo_path)}"
}

}

logs_config {
Expand All @@ -521,7 +552,7 @@ resource "aws_codebuild_project" "update_service" {

source {
type = "CODEPIPELINE"
buildspec = "buildspec-update_service.yml"
buildspec = "${var.repo_path}/buildspec-update_service.yml"
}

vpc_config {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,10 @@ variable "e2e_image" {
type = string
default = "cypress/browsers:chrome69"
description = "Docker image for e2e stages"
}

variable "repo_path" {
type = string
default = "."
description = "Path in repository to look for Dockerfile and buildspecs"
}

0 comments on commit e579fd0

Please sign in to comment.