Skip to content

Instantly share code, notes, and snippets.

@stojce
Last active August 31, 2021 18:43
Show Gist options
  • Save stojce/284e0299529ee000926aabc18b665fbe to your computer and use it in GitHub Desktop.
Save stojce/284e0299529ee000926aabc18b665fbe to your computer and use it in GitHub Desktop.
resource "aws_codepipeline" "static_web_pipeline" {
name = "static-web-pipeline"
role_arn = data.aws_iam_role.pipeline_role.arn
tags = {
Environment = var.env
}
artifact_store {
location = var.artifacts_bucket_name
type = "S3"
}
stage {
name = "Source"
action {
category = "Source"
configuration = {
"Branch" = var.repository_branch
"Owner" = var.repository_owner
"PollForSourceChanges" = "false"
"Repo" = var.repository_name
}
input_artifacts = []
name = "Source"
output_artifacts = [
"SourceArtifact",
]
owner = "ThirdParty"
provider = "GitHub"
run_order = 1
version = "1"
}
}
stage {
name = "Build"
action {
category = "Build"
configuration = {
"EnvironmentVariables" = jsonencode(
[
{
name = "environment"
type = "PLAINTEXT"
value = var.env
},
]
)
"ProjectName" = "static-web-build"
}
input_artifacts = [
"SourceArtifact",
]
name = "Build"
output_artifacts = [
"BuildArtifact",
]
owner = "AWS"
provider = "CodeBuild"
run_order = 1
version = "1"
}
}
stage {
name = "Deploy"
action {
category = "Deploy"
configuration = {
"BucketName" = var.static_web_bucket_name
"Extract" = "true"
}
input_artifacts = [
"BuildArtifact",
]
name = "Deploy"
output_artifacts = []
owner = "AWS"
provider = "S3"
run_order = 1
version = "1"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment