Exemple #1
0
        public void Should_Initialize_RouteTable_Properties_Correctly()
        {
            var routesCollection = new RouteCollection();
            var table            = new DefaultRouteTable(routesCollection);

            Assert.AreEqual(table.Routes, routesCollection);
        }
        public static Subnet CreateSubnet()
        {
            var vpc = new Vpc($"{Common.appName}-vpc", new VpcArgs()
            {
                EnableDnsHostnames = true,
                EnableDnsSupport   = true,
                CidrBlock          = $"{vpcCidrBase}.0/24",
                Tags = Common.tags
            });



            var ig = new InternetGateway($"{Common.appName}-igw", new InternetGatewayArgs()
            {
                VpcId = vpc.Id,
                Tags  = Common.tags
            });

            var rt = new RouteTable($"{Common.appName}-rt", new RouteTableArgs()
            {
                VpcId = vpc.Id,
                Tags  = Common.tags
            });

            var subnet = new Subnet($"{Common.appName}-subnet", new SubnetArgs {
                VpcId     = vpc.Id,
                CidrBlock = $"{vpcCidrBase}.0/25",
                Tags      = Common.tags
            });

            var rta = new RouteTableAssociation($"{Common.appName}-rta", new RouteTableAssociationArgs()
            {
                RouteTableId = rt.Id,
                SubnetId     = subnet.Id,
            });

            var drt = new DefaultRouteTable($"{Common.appName}-drt", new DefaultRouteTableArgs()
            {
                DefaultRouteTableId = rt.Id,
                Routes = new InputList <DefaultRouteTableRouteArgs> {
                    new DefaultRouteTableRouteArgs()
                    {
                        CidrBlock = "0.0.0.0/0", GatewayId = ig.Id
                    }
                },
                Tags = Common.tags
            });

            return(subnet);
        }