137 lines
2.2 KiB
HCL
137 lines
2.2 KiB
HCL
resource "aws_iam_instance_profile" "masters" {
|
|
name = "masters"
|
|
roles = ["${aws_iam_role.masters.name}"]
|
|
}
|
|
|
|
resource "aws_iam_role" "masters" {
|
|
name = "masters"
|
|
path = "/"
|
|
assume_role_policy = <<EOF
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Action": "sts:AssumeRole",
|
|
"Principal": {
|
|
"Service": "ec2.amazonaws.com"
|
|
},
|
|
"Effect": "Allow",
|
|
"Sid": ""
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "aws_iam_role_policy" "masters" {
|
|
name = "masters_policy"
|
|
role = "${aws_iam_role.masters.id}"
|
|
policy = <<EOF
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Action": [
|
|
"ec2:Describe*"
|
|
],
|
|
"Effect": "Allow",
|
|
"Resource": "*"
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "aws_iam_instance_profile" "nodes" {
|
|
name = "nodes"
|
|
roles = ["${aws_iam_role.nodes.name}"]
|
|
}
|
|
|
|
resource "aws_iam_role" "nodes" {
|
|
name = "nodes"
|
|
path = "/"
|
|
assume_role_policy = <<EOF
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Action": "sts:AssumeRole",
|
|
"Principal": {
|
|
"Service": "ec2.amazonaws.com"
|
|
},
|
|
"Effect": "Allow",
|
|
"Sid": ""
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "aws_iam_role_policy" "nodes" {
|
|
name = "nodes_policy"
|
|
role = "${aws_iam_role.nodes.id}"
|
|
policy = <<EOF
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Action": [
|
|
"ec2:Describe*"
|
|
],
|
|
"Effect": "Allow",
|
|
"Resource": "*"
|
|
},{
|
|
"Action": [
|
|
"elasticloadbalancing:*"
|
|
],
|
|
"Effect": "Allow",
|
|
"Resource": "*"
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "aws_iam_instance_profile" "etcd" {
|
|
name = "etcd"
|
|
roles = ["${aws_iam_role.etcd.name}"]
|
|
}
|
|
|
|
resource "aws_iam_role" "etcd" {
|
|
name = "etcd"
|
|
path = "/"
|
|
assume_role_policy = <<EOF
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Action": "sts:AssumeRole",
|
|
"Principal": {
|
|
"Service": "ec2.amazonaws.com"
|
|
},
|
|
"Effect": "Allow",
|
|
"Sid": ""
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "aws_iam_role_policy" "etcd" {
|
|
name = "etcd_policy"
|
|
role = "${aws_iam_role.etcd.id}"
|
|
policy = <<EOF
|
|
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Action": [
|
|
"ec2:Describe*"
|
|
],
|
|
"Effect": "Allow",
|
|
"Resource": "*"
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
}
|