new SecurityGroup(this,“sec1grp”,{
name: "security1",
vpcId:"vpcs",
ingress:[{
fromPort: 22 ,
toPort: 65535 ,
cidrBlocks: [ "41.79.199.44/32"],
protocol: "tcp"
},
{
fromPort: 80 ,
toPort: 65535 ,
cidrBlocks: [ "0.0.0.0/0"],
protocol: "tcp"
},
{
fromPort: 443 ,
toPort: 65535 ,
cidrBlocks: [ "0.0.0.0/0"],
protocol: "tcp"
},
{
fromPort: 5432 ,
toPort: 65535 ,
cidrBlocks: [ "0.0.0.0/0"],
protocol: "tcp"
}],
egress:[{
fromPort: 0 ,
toPort: 0 ,
cidrBlocks: [ "0.0.0.0/0"],
protocol: "-1"
}]
}
)
new TerraformVariable(this,“ports”,{
type:"list",
default: [ 22 , 80 , 443 ,5432 ]
})
new TerraformOutput(this, “portsout” .{
value: "ports"
})
terraform cdktf how to reference variable to resource for similier to terraform var,ports for related typescript and reference resource id to other resource for example vpc_id