add missing IAM instance policy

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-06-03 13:28:47 -04:00
parent 9747601f1b
commit eb5d1dc7cd
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 44 additions and 1 deletions

45
dev.tf
View File

@ -1,7 +1,11 @@
locals {
name = "dev-dap-ps"
}
/* ACCESS ---------------------------------------*/
resource "aws_iam_group" "deploy" {
name = "dev-dap-ps-deploy"
name = "${local.name}-deploy"
}
resource "aws_iam_user" "deploy" {
@ -22,6 +26,39 @@ resource "aws_iam_policy_attachment" "deploy" {
policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkFullAccess"
}
/* ROLES ----------------------------------------*/
resource "aws_iam_instance_profile" "main" {
name = "${local.name}"
role = "${aws_iam_role.main.name}"
}
resource "aws_iam_role" "main" {
name = "${local.name}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_iam_policy_attachment" "AWSElasticBeanstalkWebTier" {
name = "${local.name}-AWSElasticBeanstalkWebTier"
roles = ["${aws_iam_role.main.name}"]
policy_arn ="arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier"
}
/* RESOURCES ------------------------------------*/
resource "aws_elastic_beanstalk_application" "dev_dap_ps" {
@ -33,4 +70,10 @@ resource "aws_elastic_beanstalk_environment" "dev_dap_ps" {
name = "dev-dap-ps-app"
application = "${aws_elastic_beanstalk_application.dev_dap_ps.name}"
solution_stack_name = "64bit Amazon Linux 2018.03 v4.8.3 running Node.js"
setting {
namespace = "aws:autoscaling:launchconfiguration"
name = "IamInstanceProfile"
value = "${aws_iam_instance_profile.main.name}"
}
}