diff --git a/dns.tf b/dns.tf index 9e814ed..beb4322 100644 --- a/dns.tf +++ b/dns.tf @@ -37,13 +37,3 @@ resource "gandi_zonerecord" "dap_ps_site" { "185.199.111.153", ] } - -/* DEV SITE -------------------------------------*/ - -resource "gandi_zonerecord" "dev_dap_ps_site" { - zone = "${gandi_zone.dap_ps_zone.id}" - name = "dev" - type = "CNAME" - ttl = 3600 - values = ["${aws_elastic_beanstalk_environment.dev_dap_ps.cname}."] -} diff --git a/main.tf b/main.tf index 2b5a837..8b983d9 100644 --- a/main.tf +++ b/main.tf @@ -41,3 +41,13 @@ resource "aws_s3_bucket" "tf-state" { prevent_destroy = true } } + +/* ENVIRONMENTS ---------------------------------*/ + +module "dev" { + source = "./modules/dev" + name = "dev-dap-ps" + gandi_zone_id = "${gandi_zone.dap_ps_zone.id}" + dns_domain = "dap.ps" + dns_entry = "dev" +} diff --git a/dev.tf b/modules/dev/main.tf similarity index 83% rename from dev.tf rename to modules/dev/main.tf index 22e57d1..8297794 100644 --- a/dev.tf +++ b/modules/dev/main.tf @@ -1,15 +1,11 @@ -locals { - name = "dev-dap-ps" -} - /* ACCESS ---------------------------------------*/ resource "aws_iam_group" "deploy" { - name = "${local.name}-deploy" + name = "${var.name}-deploy" } resource "aws_iam_user" "deploy" { - name = "${local.name}-deploy" + name = "${var.name}-deploy" tags = { Description = "User for deploying the dap.ps Elastic Beanstalk app" } @@ -45,12 +41,12 @@ output "deploy_secret_key" { /* ROLES ----------------------------------------*/ resource "aws_iam_instance_profile" "main" { - name = "${local.name}" + name = "${var.name}" role = "${aws_iam_role.main.name}" } resource "aws_iam_role" "main" { - name = "${local.name}" + name = "${var.name}" assume_role_policy = <