1111
1212# Terraform AWS GitHub CI
1313
14- A Terraform module to setup a GitHub CI server with pull request and build
15- status support using AWS CodeBuild.
14+ A Terraform module to setup a serverless GitHub CI build environment with pull
15+ request and build status support using AWS CodeBuild.
1616
1717## Architecture
1818
@@ -29,51 +29,27 @@ generated and hosted on S3.
2929### Cost
3030
3131Building with this CI server is unbelievably cheap - you only pay what you use.
32- Pricings starts at 0,5 ct per build minute, and AWS CodeBuild offers 100 free
33- build minutes every month. The price for the other services (Lambda, SNS, S3
34- and CloudWatch) are negligible and should only add a few cents to your monthly
35- bill. Compare that to the $69 that services like Travis cost every month,
36- regardless of how much you use them.
32+ Pricings starts at ** $ 0,005 per build minute** , and AWS CodeBuild offers 100
33+ free build minutes every month. The price for the other services (Lambda, SNS,
34+ S3 and CloudWatch) are negligible and should only add a few cents to your
35+ monthly bill. Compare that to the $ 69 that services like Travis cost every
36+ month, regardless of how much you use them.
3737
3838## Usage
3939
4040You need an AWS and GitHub account and a repository you want to be built. The
4141repository must specify a ` buildspec.yml ` which is documented [ here] [ 2 ] . First,
4242you need to go to the [ CodeBuild] [ 3 ] dashboard in your region, manually create
4343a new project and choose GitHub as the ** Source provider** , allowing AWS to
44- authorize your account.
44+ authorize your account. Next, [ set up your AWS credentials] [ 4 ] and
45+ [ install Terraform] [ 5 ] if you haven't got it available already.
4546
4647 [ 2 ] : http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.htm
4748 [ 3 ] : https://console.aws.amazon.com/codebuild/home
48-
49- ### Standalone
50-
51- If you want to get started straight away and have no experience in Terraform,
52- just [ set up your AWS credentials] [ 4 ] , [ install Terraform] [ 5 ] , clone the
53- repository and apply the configuration from the root folder with:
54-
55- ``` bash
56- terraform apply \
57- -var namespace=< namespace> \
58- -var github_owner=< owner> \
59- -var github_repository=< repository> \
60- -var github_oauth_token=< oauth-token>
61- ```
62-
63- All resources are prefixed with the value specified as ` namespace ` . If the S3
64- bucket name (see below) is not explicitly set, it's set to the given ` namespace `
65- which means there must not already exist an S3 bucket with the same name. This
66- is a common source of error.
67-
68- Now, when you push to ` master ` , or create a pull request, CodeBuild will
69- automatically build the commit and report the status back to GitHub.
70-
7149 [ 4 ] : http://docs.aws.amazon.com/de_de/cli/latest/userguide/cli-chap-getting-started.html
7250 [ 5 ] : https://www.terraform.io/downloads.html
7351
74- ### Module
75-
76- Include and configure this module in your Terraform configuration:
52+ Next, add the following module to your Terraform configuration and apply it:
7753
7854``` hcl
7955module "github_ci" {
@@ -87,14 +63,20 @@ module "github_ci" {
8763}
8864```
8965
90- All resources (including the S3 bucket) are created through this module. After
91- applying your configuration, a status badge can be added to your project's
92- README using the ` codebuild_badge_url ` and ` codebuild_url ` outputs printed to
93- the terminal .
66+ All resources are prefixed with the value specified as ` namespace ` . If the S3
67+ bucket name (see below) is not explicitly set, it's set to the given ` namespace `
68+ which means there must not already exist an S3 bucket with the same name. This
69+ is a common source of error .
9470
95- ** Note** : the OAuth-token is currently mandatory, because Terraform doesn't
96- support conditional blocks inside resources. However, this feature is currently
97- [ being implemented] [ 6 ] and should be released shortly.
71+ Now, when you push to ` master ` , or create a pull request, CodeBuild will
72+ automatically build the commit and report the status back to GitHub. A status
73+ badge can be added to your project's README using the ` codebuild_badge_url ` and
74+ ` codebuild_url ` outputs printed to the terminal.
75+
76+ ** Note** : the OAuth-token is currently mandatory (also for public repositories),
77+ because Terraform doesn't support conditional blocks inside resources. However,
78+ this feature is currently [ being implemented] [ 6 ] and should be released shortly.
79+ If you want to omit it, create your own CodeBuild project [ see below] [ 6 ] .
9880
9981 [ 6 ] : https://github.com/hashicorp/terraform/issues/7034
10082
0 commit comments