constructor()

in terraform/learn-cdktf-typescript/main.ts [7:33]


  constructor(scope: Construct, id: string) {
    super(scope, id)

    new AwsProvider(this, 'aws', {
      region: 'ap-northeast-1',
    })

    const vpc = new Vpc(this, 'vpc', {
      cidrBlock: "10.0.0.0/16"
    })

    const subnet = new Subnet(this, 'private-subnet', {
      cidrBlock: "10.0.0.0/24",
      vpcId: vpc.id
    })

    const instance = new Instance(this, 'compute', {
      instanceType: 't2.micro',
      ami: "ami-02892a4ea9bfa2192", // Amazon Linux 2 AMI (HVM), SSD Volume Type
      associatePublicIpAddress: false,
      subnetId: subnet.id
    })

    new TerraformOutput(this, 'public_ip', {
      value: instance.id,
    })
  }