Skip to content

Commit e12590d

Browse files
authored
Initial implementation (#1)
* Initial implementation * Update module versions * Update `BUILD_HARNESS_VERSION` * Update `region` * Add `docs` project * Fix `default` attribute * Fix `attributes` var * Fix `docs_cloudfront_origin_access_identity_path` output * Update `docs` project * Remove `Host` forwarded header (not needed for S3 website) * Use `s3_bucket_website_endpoint` as origin * Add `docs` outputs * Update module versions. Add `enabled` flags * Bump `terraform-aws-tfstate-backend` version * Add `acm_cloudfront` project * Rename to `acm-cloudfront` * Update `viewer_protocol_policy` and `aliases` * Update `aliases` * Update `aliases`
1 parent 19ac69c commit e12590d

36 files changed

+1173
-7
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
.gitignore
3+
.editorconfig
4+
**/.terraform
5+
*.tfstate
6+
*.tfstate.*
7+
.idea
8+
*.iml

.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
9+
# Override for Makefile
10+
[{Makefile, makefile, GNUmakefile}]
11+
indent_style = tab
12+
indent_size = 4
13+
14+
[Makefile.*]
15+
indent_style = tab
16+
indent_size = 4
17+
18+
[shell]
19+
indent_style = tab
20+
indent_size = 4
21+
22+
[*.sh]
23+
indent_style = tab
24+
indent_size = 4

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Compiled files
1+
.build-harness
2+
build-harness
3+
.terraform
24
*.tfstate
3-
*.tfstate.backup
4-
5-
# Module directory
6-
.terraform/
5+
*.tfstate.*
6+
.idea
7+
*.iml

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM alpine:3.7
2+
COPY aws/ /aws
3+
WORKDIR /aws

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2018 Cloud Posse, LLC
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export DOCKER_ORG ?= cloudposse
2+
export DOCKER_IMAGE ?= $(DOCKER_ORG)/terraform-root-modules
3+
export DOCKER_TAG ?= latest
4+
export DOCKER_IMAGE_NAME ?= $(DOCKER_IMAGE):$(DOCKER_TAG)
5+
export DOCKER_BUILD_FLAGS =
6+
7+
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
8+
9+
all: init deps build install run
10+
11+
deps:
12+
@exit 0
13+
14+
build:
15+
@make --no-print-directory docker:build
16+
17+
push:
18+
docker push $(DOCKER_IMAGE)
19+
20+
run:
21+
docker run -it ${DOCKER_IMAGE_NAME} sh

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# terraform-root-modules
2-
Collection of root modules for provisioning reference architectures
2+
3+
This is a collection of reusable root modules for CloudPosse AWS accounts.

aws/acm-cloudfront/main.tf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
terraform {
2+
required_version = ">= 0.11.2"
3+
4+
backend "s3" {}
5+
}
6+
7+
variable "aws_assume_role_arn" {}
8+
9+
provider "aws" {
10+
# CloudFront certs must be created in the `aws-east-1` region, even if your origin is in a different one
11+
# This is a CloudFront limitation
12+
# https://christian.legnitto.com/blog/2017/10/11/terraform-and-cloudfront-gotchas/
13+
# https://medium.com/modern-stack/5-minute-static-ssl-website-in-aws-with-terraform-76819a12d412
14+
# https://medium.com/runatlantis/hosting-our-static-site-over-ssl-with-s3-acm-cloudfront-and-terraform-513b799aec0f
15+
region = "us-east-1"
16+
17+
assume_role {
18+
role_arn = "${var.aws_assume_role_arn}"
19+
}
20+
}
21+
22+
variable "domain_name" {
23+
description = "Domain name (E.g. staging.cloudposse.org)"
24+
}
25+
26+
module "certificate" {
27+
source = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=tags/0.1.1"
28+
domain_name = "${var.domain_name}"
29+
proces_domain_validation_options = "true"
30+
ttl = "300"
31+
subject_alternative_names = ["*.${var.domain_name}"]
32+
}
33+
34+
output "certificate_domain_name" {
35+
value = "${var.domain_name}"
36+
}
37+
38+
output "certificate_id" {
39+
value = "${module.certificate.id}"
40+
}
41+
42+
output "certificate_arn" {
43+
value = "${module.certificate.arn}"
44+
}
45+
46+
output "certificate_domain_validation_options" {
47+
value = "${module.certificate.domain_validation_options}"
48+
}

aws/acm/main.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
terraform {
2+
required_version = ">= 0.11.2"
3+
4+
backend "s3" {}
5+
}
6+
7+
variable "aws_assume_role_arn" {}
8+
9+
provider "aws" {
10+
assume_role {
11+
role_arn = "${var.aws_assume_role_arn}"
12+
}
13+
}
14+
15+
variable "domain_name" {
16+
description = "Domain name (E.g. staging.cloudposse.org)"
17+
}
18+
19+
module "certificate" {
20+
source = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=tags/0.1.1"
21+
domain_name = "${var.domain_name}"
22+
proces_domain_validation_options = "true"
23+
ttl = "300"
24+
subject_alternative_names = ["*.${var.domain_name}"]
25+
}
26+
27+
output "certificate_domain_name" {
28+
value = "${var.domain_name}"
29+
}
30+
31+
output "certificate_id" {
32+
value = "${module.certificate.id}"
33+
}
34+
35+
output "certificate_arn" {
36+
value = "${module.certificate.arn}"
37+
}
38+
39+
output "certificate_domain_validation_options" {
40+
value = "${module.certificate.domain_validation_options}"
41+
}

aws/acm/terraform.tfvars.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
domain_name="foobar.domain.com"

0 commit comments

Comments
 (0)