diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..7df8ddf --- /dev/null +++ b/main.tf @@ -0,0 +1,46 @@ +/* DERIVED --------------------------------------*/ + +provider "aws" { + region = "us-east-1" + access_key = "${var.aws_access_key}" + secret_key = "${var.aws_secret_key}" +} + +//provider "gandi" { +// key = "" +// sharing_id = "" +//} + +/* DATA -----------------------------------------*/ + +//terraform { +// backend "s3" { +// bucket = "dapps-terraform-state" +// key = "infra-dapps" +// region = "us-east-2" +// encrypt = true +// } +//} + +/* INVENTORY ------------------------------------*/ + +resource "aws_s3_bucket" "tf-state" { + bucket = "dapps-terraform-state" + acl = "private" + + tags = { + Name = "Terraform State Store" + } + + policy = "${file("s3policy.json")}" + + versioning { + enabled = true + } + + lifecycle { + prevent_destroy = true + } +} + +/* RESOURCES ------------------------------------*/ diff --git a/s3policy.json b/s3policy.json new file mode 100644 index 0000000..fe4b62c --- /dev/null +++ b/s3policy.json @@ -0,0 +1,12 @@ +{ + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::760668534108:user/terraform-user" + }, + "Action": "s3:*", + "Resource": "arn:aws:s3:::dapps-infra-tf-state" + } + ] +} diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..da866a4 --- /dev/null +++ b/variables.tf @@ -0,0 +1,21 @@ +/* REQUIRED -------------------------------------*/ + +variable aws_access_key { + description = "Access key for the AWS API." +} + +variable aws_secret_key { + description = "Secret key for the AWS API." +} + +/* GENERAL --------------------------------------*/ + +variable hosts_domain { + description = "Domain for hosts entries." + default = "hosts.dap.ps" +} + +variable public_domain { + description = "Public DNS Domain address" + default = "dap.ps" +}