diff --git a/ec2.tf b/ec2.tf index 6c8b154..e3e06eb 100644 --- a/ec2.tf +++ b/ec2.tf @@ -26,5 +26,5 @@ resource "aws_instance" "bastion" { key_name = "${var.key_name}" iam_instance_profile = "${aws_iam_instance_profile.ansible_ec2.name}" - tags = "${merge(map("cluster", "${var.cluster_name}"), var.resource_tags)}" + tags = "${merge(map("network", "${var.network_name}", "Name", "${var.network_name}-bastion"), var.resource_tags)}" } diff --git a/instance_profile.tf b/instance_profile.tf index e7792b0..ca6321a 100644 --- a/instance_profile.tf +++ b/instance_profile.tf @@ -1,21 +1,21 @@ -resource "aws_iam_instance_profile" "ansible_ec2" { - name = "${var.cluster_name}-ec2-ro" +resource "aws_iam_instance_profile" "bastion_ro" { + name = "${var.network_name}-ec2-ro" role = "${aws_iam_role.ansible_ec2.name}" } -resource "aws_iam_policy" "ansible_ec2" { - name = "${var.cluster_name}-ec2-ro" +resource "aws_iam_policy" "bastion_ro" { + name = "${var.network_name}-ec2-ro" path = "/" policy = "${file("${path.module}/policy.json")}" } -resource "aws_iam_role_policy_attachment" "ansible_ec2" { +resource "aws_iam_role_policy_attachment" "bastion_ro" { role = "${aws_iam_role.ansible_ec2.name}" policy_arn = "${aws_iam_policy.ansible_ec2.arn}" } resource "aws_iam_role" "ansible_ec2" { - name = "${var.cluster_name}-ec2-ro" + name = "${var.network_name}-ec2-ro" path = "/" assume_role_policy = "${file("${path.module}/role.json")}" diff --git a/sec_groups.tf b/sec_groups.tf index bcb71b9..fb292c7 100644 --- a/sec_groups.tf +++ b/sec_groups.tf @@ -1,5 +1,5 @@ resource "aws_security_group" "bastion" { - name = "${var.cluster_name}-bastion" + name = "${var.network_name}-bastion" vpc_id = "${var.vpc_id}" ingress { diff --git a/variables.tf b/variables.tf index fda2279..97386ac 100644 --- a/variables.tf +++ b/variables.tf @@ -35,7 +35,7 @@ variable "resource_tags" { default = {} } -variable "cluster_name" { - description = "Name of the cluster this bastion host will allow access to" +variable "network_name" { + description = "Name of the network this bastion host will allow access to" type = "string" }