2019-05-28 16:33:58 +00:00
|
|
|
/* DERIVED --------------------------------------*/
|
|
|
|
|
2019-08-16 12:56:34 +00:00
|
|
|
provider "dns" {}
|
|
|
|
|
2019-05-28 16:33:58 +00:00
|
|
|
provider "aws" {
|
|
|
|
region = "us-east-1"
|
2019-07-30 18:36:52 +00:00
|
|
|
access_key = var.aws_access_key
|
|
|
|
secret_key = var.aws_secret_key
|
|
|
|
version = "<= 2.21.0"
|
2019-05-28 16:33:58 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 18:51:33 +00:00
|
|
|
provider "gandi" {
|
2019-07-30 18:36:52 +00:00
|
|
|
key = var.gandi_api_token
|
|
|
|
version = ">= 1.1.0"
|
2019-05-28 18:51:33 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 16:33:58 +00:00
|
|
|
/* DATA -----------------------------------------*/
|
|
|
|
|
2019-05-28 16:50:35 +00:00
|
|
|
terraform {
|
|
|
|
backend "s3" {
|
2019-07-29 20:52:10 +00:00
|
|
|
bucket = "dapps-terraform-state"
|
|
|
|
key = "infra-dapps"
|
|
|
|
region = "us-east-1"
|
|
|
|
encrypt = true
|
2019-05-28 16:50:35 +00:00
|
|
|
}
|
|
|
|
}
|
2019-05-28 16:33:58 +00:00
|
|
|
|
|
|
|
/* INVENTORY ------------------------------------*/
|
|
|
|
|
|
|
|
resource "aws_s3_bucket" "tf-state" {
|
|
|
|
bucket = "dapps-terraform-state"
|
|
|
|
acl = "private"
|
|
|
|
|
|
|
|
tags = {
|
|
|
|
Name = "Terraform State Store"
|
|
|
|
}
|
|
|
|
|
2019-07-30 18:36:52 +00:00
|
|
|
policy = file("files/s3-policy.json")
|
2019-05-28 16:33:58 +00:00
|
|
|
|
|
|
|
versioning {
|
|
|
|
enabled = true
|
|
|
|
}
|
2019-07-29 20:52:10 +00:00
|
|
|
|
2019-05-28 16:33:58 +00:00
|
|
|
lifecycle {
|
|
|
|
prevent_destroy = true
|
|
|
|
}
|
|
|
|
}
|
2019-07-25 16:53:20 +00:00
|
|
|
|
2019-07-25 17:14:50 +00:00
|
|
|
/* Gandi DNS ------------------------------------*/
|
|
|
|
|
|
|
|
resource "gandi_zone" "dap_ps_zone" {
|
|
|
|
name = "${var.public_domain} zone"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "gandi_domainattachment" "dap_ps" {
|
2019-07-30 18:36:52 +00:00
|
|
|
domain = var.public_domain
|
|
|
|
zone = gandi_zone.dap_ps_zone.id
|
2019-07-25 17:14:50 +00:00
|
|
|
}
|
|
|
|
|
2019-07-25 21:05:05 +00:00
|
|
|
/* ACCESS ---------------------------------------*/
|
|
|
|
|
|
|
|
resource "aws_key_pair" "admin" {
|
|
|
|
key_name = "admin-key"
|
2019-07-30 18:36:52 +00:00
|
|
|
public_key = file("files/admin.pub")
|
2019-07-25 21:05:05 +00:00
|
|
|
}
|