mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-28 21:01:57 +03:00
elasticbeanstalk demo fixes
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# iam roles
|
||||
resource "aws_iam_role" "app-ec2-role" {
|
||||
name = "app-ec2-role"
|
||||
assume_role_policy = <<EOF
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Action": "sts:AssumeRole",
|
||||
"Principal": {
|
||||
"Service": "ec2.amazonaws.com"
|
||||
},
|
||||
"Effect": "Allow",
|
||||
"Sid": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
}
|
||||
resource "aws_iam_instance_profile" "app-ec2-role" {
|
||||
name = "app-ec2-role"
|
||||
roles = ["${aws_iam_role.app-ec2-role.name}"]
|
||||
}
|
||||
|
||||
# service
|
||||
resource "aws_iam_role" "elasticbeanstalk-service-role" {
|
||||
name = "elasticbeanstalk-service-role"
|
||||
assume_role_policy = <<EOF
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Action": "sts:AssumeRole",
|
||||
"Principal": {
|
||||
"Service": "elasticbeanstalk.amazonaws.com"
|
||||
},
|
||||
"Effect": "Allow",
|
||||
"Sid": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
# policies
|
||||
resource "aws_iam_policy_attachment" "app-attach1" {
|
||||
name = "app-attach1"
|
||||
roles = ["${aws_iam_role.app-ec2-role.name}"]
|
||||
policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier"
|
||||
}
|
||||
resource "aws_iam_policy_attachment" "app-attach2" {
|
||||
name = "app-attach2"
|
||||
roles = ["${aws_iam_role.app-ec2-role.name}"]
|
||||
policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker"
|
||||
}
|
||||
resource "aws_iam_policy_attachment" "app-attach3" {
|
||||
name = "app-attach3"
|
||||
roles = ["${aws_iam_role.app-ec2-role.name}"]
|
||||
policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier"
|
||||
}
|
||||
resource "aws_iam_policy_attachment" "app-attach4" {
|
||||
name = "app-attach4"
|
||||
roles = ["${aws_iam_role.elasticbeanstalk-service-role.name}"]
|
||||
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth"
|
||||
}
|
||||
Reference in New Issue
Block a user