```export class BTnetwork extends pulumi.Component...
# aws
p
Copy code
export class BTnetwork extends pulumi.ComponentResource {
  public vpc: aws.ec2.Vpc;
  public subnet1: aws.ec2.Subnet;
  public subnet2: aws.ec2.Subnet;

  constructor(
    vpcname: string,
    vpccidrblock: string,
    subnet1name: string,
    subnet1cidr: string,
    subnet1az: string,
    subnet2name: string,
    subnet2cidr: string,
    subnet2az: string,

    opts?: ResourceOptions
  ) {
    super("beyondtrust:network:BTnetwork", vpcname, {}, opts);
    this.vpc = new aws.ec2.Vpc(
      vpcname,
      {
        cidrBlock: vpccidrblock,
        instanceTenancy: "dedicated",
        tags: {
          Name: "BeyondTrust VPC",
          Application: baseTags.Application,
          TeamName: baseTags.Team,
          CostCenter: baseTags.CostCenter,
        },
      },
      { parent: this }
    );
    this.registerOutputs({
      VPCID: this.vpc.id,
  });

    this.subnet1 = new aws.ec2.Subnet(
      subnet1name,
      {
        vpcId: this.vpc.id,
        cidrBlock: subnet1cidr,
        availabilityZone: subnet1az,
        tags: {
          Name: "BeyondTrust Subnet 1",
          Application: baseTags.Application,
          TeamName: baseTags.Team,
          CostCenter: baseTags.CostCenter,
        },
      },
      {
        parent: this,
      }
    );
    this.subnet2 = new aws.ec2.Subnet(
      subnet2name,
      {
        vpcId: this.vpc.id,
        cidrBlock: subnet2cidr,
        availabilityZone: subnet2az,
        tags: {
          Name: "BeyondTrust Subnet 2",
          Application: baseTags.Application,
          TeamName: baseTags.Team,
          CostCenter: baseTags.CostCenter,
        },
      },
      {
        parent: this,
      }
    );
  }
}
g
I always pass the entire object instead of outputs, it makes it way easier, I also set
public readonly vpc: aws.ec2.Vpc
p
Ah that makes sense. Thanks Jan I really appreciate the help.