2019-05-28 16:33:58 +00:00
|
|
|
/* DERIVED --------------------------------------*/
|
|
|
|
|
|
|
|
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
|
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 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
|
|
|
}
|
2019-10-04 12:55:12 +00:00
|
|
|
|
|
|
|
data "aws_caller_identity" "current" {}
|