Skip to content

Commit ab5c0a9

Browse files
committed
add module as aws 2.x supported and styling changes
1 parent 4d467a6 commit ab5c0a9

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

modules/aws-codebuild-step/example/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
provider "aws" {
2+
version = ">= 3.0"
23
region = "us-east-1"
34
}
45

56
module "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"

modules/aws-codebuild-step/example/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ variable "environment" {
44
}
55

66
variable "repo_owner" {
7-
description = "Organization/username owning repository on github "
7+
description = "Organization/username owning repository on github."
88
}
99

1010
variable "repo_name" {
11-
description = "Name of repository"
11+
description = "Name of repository."
1212
}
1313

1414
variable "repo_branch" {

modules/aws-codebuild-step/main.tf

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,24 @@
77
data "aws_caller_identity" "current" {}
88
data "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+
1021
resource "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

7169
resource "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

7674
resource "aws_codebuild_project" "project" {

modules/aws-codebuild-step/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)