devops-exercises/topics/aws/exercises/subnets/pulumi/__main__.py
abregman 03a92d5bea Add different solutions to AWS exercises
Not only console solutions, but also Terraform and Pulumi.

In addition, this change fixes issues #279 and #280
2022-08-24 21:13:39 +03:00

27 lines
663 B
Python

import pulumi
import pulumi_aws as aws
availableZones = pulumi_aws.get_availability_zones(state="available")
aws.ec2.Subnet("NewSubnet1",
vpc_id=aws_vpc["main"]["id"],
cidr_block="10.0.0.0/24",
availability_zone=availableZones.names[0],
tags={"Name": "NewSubnet1"}
)
aws.ec2.Subnet("NewSubnet2",
vpc_id=aws_vpc["main"]["id"],
cidr_block="10.0.1.0/24",
availability_zone=availableZones.names[1]
tags={"Name": "NewSubnet2"}
)
aws.ec2.Subnet("NewSubnet3",
vpc_id=aws_vpc["main"]["id"],
cidr_block="10.0.2.0/24",
availability_zone=availableZones.names[2]
tags={"Name": "NewSubnet3"}
)
# Run "pulumi up"