mirror of
https://github.com/hashicorp/terraform.git
synced 2026-04-15 22:10:37 -04:00
58 lines
941 B
HCL
58 lines
941 B
HCL
resource "aws_security_group" "firewall" {
|
|
lifecycle {
|
|
create_before_destroy = true
|
|
prevent_destroy = true
|
|
ignore_changes = [
|
|
description,
|
|
]
|
|
}
|
|
|
|
connection {
|
|
host = "127.0.0.1"
|
|
}
|
|
|
|
provisioner "local-exec" {
|
|
command = "echo hello"
|
|
|
|
connection {
|
|
host = "10.1.2.1"
|
|
}
|
|
}
|
|
|
|
provisioner "local-exec" {
|
|
command = "echo hello"
|
|
}
|
|
}
|
|
|
|
resource "aws_instance" "web" {
|
|
count = 2
|
|
ami = "ami-1234"
|
|
security_groups = [
|
|
"foo",
|
|
"bar",
|
|
]
|
|
|
|
network_interface {
|
|
device_index = 0
|
|
description = "Main network interface"
|
|
}
|
|
|
|
depends_on = [
|
|
aws_security_group.firewall,
|
|
]
|
|
}
|
|
|
|
resource "aws_instance" "depends" {
|
|
lifecycle {
|
|
replace_triggered_by = [ aws_instance.web[1], aws_security_group.firewall.id ]
|
|
}
|
|
}
|
|
|
|
ephemeral "aws_connect" "tunnel" {
|
|
}
|
|
|
|
ephemeral "aws_secret" "auth" {
|
|
for_each = local.auths
|
|
input = each.value
|
|
depends_on = [aws_instance.depends]
|
|
}
|