aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/terraform-aws-subnet/main.tf
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2022-03-24 14:13:32 +0100
committerPeter Mikus <pmikus@cisco.com>2022-03-25 08:17:41 +0000
commit0deec65be1ef39f37090f2b5b851eb4b34c116f9 (patch)
tree409feeeb125116ba60f0eea3f9c872f98e9e23ea /fdio.infra.terraform/terraform-aws-subnet/main.tf
parentc5181ae1627fed20b79a829bf2330f3ee9d8a0f6 (diff)
feat(terraform): AWS Subnet
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I11d10c4c734354f112a7b6bf4a8f3c0febfc0862
Diffstat (limited to 'fdio.infra.terraform/terraform-aws-subnet/main.tf')
-rw-r--r--fdio.infra.terraform/terraform-aws-subnet/main.tf26
1 files changed, 26 insertions, 0 deletions
diff --git a/fdio.infra.terraform/terraform-aws-subnet/main.tf b/fdio.infra.terraform/terraform-aws-subnet/main.tf
new file mode 100644
index 0000000000..d14aa5f827
--- /dev/null
+++ b/fdio.infra.terraform/terraform-aws-subnet/main.tf
@@ -0,0 +1,26 @@
+locals {
+ tags = {
+ "Name" = "${var.tags_name}"
+ "Environment" = "${var.tags_environment}"
+ }
+}
+
+# Create VPC IPv4 CIDR Block Association
+resource "aws_vpc_ipv4_cidr_block_association" "ipv4_cidr_block_association" {
+ cidr_block = var.subnet_cidr_block
+ vpc_id = var.subnet_vpc_id
+}
+
+# Create Subnet
+resource "aws_subnet" "subnet" {
+ depends_on = [
+ aws_vpc_ipv4_cidr_block_association.ipv4_cidr_block_association
+ ]
+ assign_ipv6_address_on_creation = var.subnet_assign_ipv6_address_on_creation
+ availability_zone = var.subnet_availability_zone
+ cidr_block = var.subnet_cidr_block
+ ipv6_cidr_block = var.subnet_ipv6_cidr_block
+ map_public_ip_on_launch = var.subnet_map_public_ip_on_launch
+ tags = local.tags
+ vpc_id = var.subnet_vpc_id
+}