Created
September 3, 2018 04:42
-
-
Save lawliet89/6293525a06cc85e48372b1cb10f0186d to your computer and use it in GitHub Desktop.
Terraform Demo Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_security_group" "client" { | |
name_prefix = "${var.client_asg_name}" | |
description = "Security Group for ${var.client_asg_name}" | |
vpc_id = "${var.vpc_id}" | |
tags = "${merge(var.tags, map("Name", "${var.client_asg_name}"))}" | |
# aws_launch_configuration.launch_configuration in this module sets create_before_destroy to true, which means | |
# everything it depends on, including this resource, must set it as well, or you'll get cyclic dependency errors | |
# when you try to do a terraform destroy. | |
lifecycle { | |
create_before_destroy = true | |
} | |
} | |
resource "aws_security_group_rule" "client_ssh_inbound" { | |
type = "ingress" | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = ["${var.ssh_cidr}"] | |
security_group_id = "${aws_security_group.client.id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment