File tree Expand file tree Collapse file tree 4 files changed +22
-23
lines changed
modules/aws-codebuild-step Expand file tree Collapse file tree 4 files changed +22
-23
lines changed Original file line number Diff line number Diff line change 11provider "aws" {
2+ version = " >= 3.0"
23 region = " us-east-1"
34}
45
56module "build" {
67 source = " ../"
78
89 project_name = " build-${ var . environment } "
9- description = " thing_that_build "
10+ description = " Step for building our frontend app "
1011 artifact_s3_arn = aws_s3_bucket. codepipeline_bucket . arn
1112
1213 buildspec_path = " .aws/dev/build.yaml"
@@ -30,7 +31,7 @@ module "deploy" {
3031 source = " ../"
3132
3233 project_name = " website-deploy-${ var . environment } "
33- description = " thing_that_deploys_whatever_we_built "
34+ description = " Step for deploying our frontend app "
3435 artifact_s3_arn = aws_s3_bucket. codepipeline_bucket . arn
3536
3637 buildspec_path = " .aws/dev/deploy.yaml"
@@ -108,10 +109,10 @@ resource "aws_codepipeline" "codepipeline" {
108109 }
109110
110111 stage {
111- name = " Deploy-front "
112+ name = " DeployFront "
112113
113114 action {
114- name = " Deploy-front "
115+ name = " DeployFront "
115116 category = " Build"
116117 owner = " AWS"
117118 provider = " CodeBuild"
Original file line number Diff line number Diff line change @@ -4,11 +4,11 @@ variable "environment" {
44}
55
66variable "repo_owner" {
7- description = " Organization/username owning repository on github "
7+ description = " Organization/username owning repository on github. "
88}
99
1010variable "repo_name" {
11- description = " Name of repository"
11+ description = " Name of repository. "
1212}
1313
1414variable "repo_branch" {
Original file line number Diff line number Diff line change 77data "aws_caller_identity" "current" {}
88data "aws_region" "current" {}
99
10+ data "aws_iam_policy_document" "task_assume" {
11+ statement {
12+ effect = " Allow"
13+ actions = [" sts:AssumeRole" ]
14+ principals {
15+ type = " Service"
16+ identifiers = [" codebuild.amazonaws.com" ]
17+ }
18+ }
19+ }
20+
1021resource "aws_iam_role" "role" {
1122 name = " ${ var . project_name } -role"
1223
13- assume_role_policy = << EOF
14- {
15- "Version": "2012-10-17",
16- "Statement": [
17- {
18- "Effect": "Allow",
19- "Principal": {
20- "Service": "codebuild.amazonaws.com"
21- },
22- "Action": "sts:AssumeRole"
23- }
24- ]
25- }
26- EOF
24+ assume_role_policy = data. aws_iam_policy_document . task_assume . json
2725}
2826
29- data "aws_iam_policy_document" "task_role_assume " {
27+ data "aws_iam_policy_document" "task " {
3028 statement {
3129 actions = [
3230 " logs:CreateLogGroup" ,
@@ -70,7 +68,7 @@ data "aws_iam_policy_document" "task_role_assume" {
7068
7169resource "aws_iam_role_policy" "role_policy" {
7270 role = aws_iam_role. role . name
73- policy = data. aws_iam_policy_document . task_role_assume . json
71+ policy = data. aws_iam_policy_document . task . json
7472}
7573
7674resource "aws_codebuild_project" "project" {
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ terraform {
22 required_version = " >= 0.12.6, < 0.14"
33
44 required_providers {
5- aws = " >= 3 .0, < 4.0"
5+ aws = " >= 2 .0, < 4.0"
66 }
77}
You can’t perform that action at this time.
0 commit comments