Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added cognifo and basic terraform configs
- Loading branch information
zthomas
committed
Nov 10, 2019
1 parent
e03d92a
commit 8d13bb5
Showing
13 changed files
with
121 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
provider "aws" { | ||
region = "${ var.region }" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
region = "{{ .Config.Infrastructure.AWS.Region }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
variable "region" { | ||
description = "The AWS region" | ||
} | ||
|
||
variable "remote_state_s3_bucket" { | ||
description = "Name of the S3 bucket to store the remote state" | ||
} | ||
|
||
variable "remote_state_dynamo_table" { | ||
description = "Dynamo DB Table to store the remote state locks" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,64 @@ | ||
provider "aws" { | ||
region = "${var.region}" | ||
} | ||
|
||
} | ||
# {{ if .Config.Infrastructure.AWS.Terraform.RemoteState }} | ||
# Store remote state in S3 | ||
resource "aws_s3_bucket" "terraform_remote_state" { | ||
bucket = "${ var.remote_state_s3_bucket }" | ||
acl = "private" | ||
|
||
versioning { | ||
enabled = true | ||
} | ||
} | ||
|
||
resource "aws_dynamodb_table" "terraform_state_locks" { | ||
name = "${ var.remote_state_dynamo_table }" | ||
read_capacity = 2 | ||
write_capacity = 2 | ||
hash_key = "LockID" | ||
|
||
attribute { | ||
name = "LockID" | ||
type = "S" | ||
} | ||
} | ||
|
||
# Reference the remote state | ||
terraform { | ||
backend "s3" { | ||
bucket = "${var.remote_state_s3_bucket}" | ||
key = "infrastructure/terraform/shared" | ||
encrypt = true | ||
region = "${var.region}" | ||
dynamodb_table = "${var.remote_state_dynamo_table}" | ||
} | ||
} | ||
# {{- end}} | ||
# {{ if .Config.Infrastructure.AWS.Cognito }} | ||
# ref: https://github.com/squidfunk/terraform-aws-cognito-auth#usage | ||
|
||
# data "aws_acm_certificate" "wildcard_cert" { | ||
# domain = "*.${var.public_dns_zone}" | ||
# } | ||
|
||
module "cognito-auth" { | ||
source = "squidfunk/cognito-auth/aws" | ||
version = "0.4.2" | ||
|
||
namespace = "${var.auth_namespace}" | ||
region = "${var.region}" | ||
cognito_identity_pool_name = "${var.auth_pool_name}" | ||
cognito_identity_pool_provider = "${var.auth_pool_provider}" | ||
|
||
# Optional: Default UI | ||
# app_hosted_zone_id = "<hosted-zone-id>" | ||
# app_certificate_arn = "${data.aws_acm_certificate.wildcard_cert.arn}" | ||
# app_domain = "<domain>" | ||
# app_origin = "<origin-domain>" | ||
|
||
# Optional: Email delivery | ||
# ses_sender_address = "<email>" | ||
} | ||
# {{- end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
variable "region" { | ||
default = "{{ .Config.Infrastructure.AWS.Region }}" | ||
description = "The AWS region" | ||
} | ||
|
||
# {{ if .Config.Infrastructure.AWS.Terraform.RemoteState }} | ||
variable "remote_state_s3_bucket" { | ||
default = "project-{{ .Config.Name }}-terraform-state" | ||
description = "Name of the S3 bucket to store the remote state" | ||
} | ||
|
||
variable "remote_state_dynamo_table" { | ||
default = "{{ .Config.Name }}-terraform-state-locks" | ||
description = "Dynamo DB Table to store the remote state locks" | ||
} | ||
# {{- end}} | ||
# {{ if .Config.Infrastructure.AWS.Cognito }} | ||
variable "auth_namespace" { | ||
default = "cognito_auth" | ||
} | ||
variable "auth_pool_name" { | ||
description = "AWS Cognito pool name" | ||
} | ||
variable "auth_pool_provider" { | ||
description = "AWS Cognito pool provider" | ||
} | ||
# {{- end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
terraform { | ||
required_version = ">= 0.12" | ||
} |