diff --git a/db.tf b/db.tf index d8cebee..71f8249 100644 --- a/db.tf +++ b/db.tf @@ -1,8 +1,3 @@ -resource "aws_key_pair" "admin" { - key_name = "admin-key" - public_key = "${file("files/admin.pub")}" -} - data "aws_ami" "ubuntu" { filter { name = "name" diff --git a/main.tf b/main.tf index d002ded..fd1228c 100644 --- a/main.tf +++ b/main.tf @@ -53,6 +53,13 @@ resource "gandi_domainattachment" "dap_ps" { zone = "${gandi_zone.dap_ps_zone.id}" } +/* ACCESS ---------------------------------------*/ + +resource "aws_key_pair" "admin" { + key_name = "admin-key" + public_key = "${file("files/admin.pub")}" +} + /* ENVIRONMENTS ---------------------------------*/ module "dev" { @@ -60,7 +67,9 @@ module "dev" { name = "dev-dap-ps" gandi_zone_id = "${gandi_zone.dap_ps_zone.id}" dns_domain = "dap.ps" - dns_entry = "dev" + stage = "dev" + stack_name = "${var.stack_name}" + keypair_name = "${aws_key_pair.admin.key_name}" } module "prod" { @@ -68,7 +77,7 @@ module "prod" { name = "prod-dap-ps" gandi_zone_id = "${gandi_zone.dap_ps_zone.id}" dns_domain = "dap.ps" - dns_entry = "@" /* just means use `dap.ps` */ + dns_entry = "prod" /* just means use `dap.ps` */ } /* MAIN SITE ------------------------------------*/ diff --git a/modules/dev/access.tf b/modules/dev/access.tf index 28866a3..9a204ee 100644 --- a/modules/dev/access.tf +++ b/modules/dev/access.tf @@ -7,7 +7,7 @@ resource "aws_iam_group" "deploy" { resource "aws_iam_user" "deploy" { name = "${var.name}-deploy" tags = { - Description = "User for deploying the ${var.dns_entry}.${var.dns_domain} Elastic Beanstalk app" + Description = "User for deploying the ${var.stage}.${var.dns_domain} Elastic Beanstalk app" } } @@ -25,37 +25,3 @@ resource "aws_iam_group_policy_attachment" "deploy" { group = "${aws_iam_group.deploy.name}" policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkFullAccess" } - -/* ROLES ----------------------------------------*/ - -resource "aws_iam_instance_profile" "main" { - name = "${var.name}" - role = "${aws_iam_role.main.name}" -} - -resource "aws_iam_role" "main" { - name = "${var.name}" - - assume_role_policy = <