variable "aws_region" {
default = "eu-central-1"
}
provider "aws" {
region = "${var.aws_region}"
}
data "terraform_remote_state" "vpc" {
backend = "s3"
config {
bucket = "tf-foobar-production"
key = "vpc/terraform.tfstate"
region = "eu-central-1"
}
}
resource "aws_security_group" "clair_allow_outbound" {
description = "Allow all outbound"
vpc_id = "${data.terraform_remote_state.vpc.vpc_id}"
}
resource "aws_security_group_rule" "allow_all" {
type = "egress"
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${aws_security_group.clair_allow_outbound.id}"
}
output "clair_sg_outbound" {
value = "${aws_security_group.clair_allow_outbound.id}"
}
{
"version": 3,
"terraform_version": "0.9.2"
.....
"aws_security_group_rule.allow_all": {
"depends_on": [
"aws_security_group.clair_allow_outbound"
],
"deposed": [],
"primary": {
"attributes": {
"cidr_blocks.#": "1",
"cidr_blocks.0": "0.0.0.0/0",
"from_port": "0",
"id": "sgrule-1926861517",
"prefix_list_ids.#": "0",
"protocol": "tcp",
"security_group_id": "sg-e16e938a",
"self": "false",
"to_port": "65535",
"type": "egress"
},
"id": "sgrule-1926861517",
"meta": {
"schema_version": "2"
},
"tainted": false
},
"provider": "",
"type": "aws_security_group_rule"
}
}
btw we are hiring :)