vp1=aws.ec2.VpcArgs( cidr_block="80.144.0.0/16...
# python
m
vp1=aws.ec2.VpcArgs( cidr_block="80.144.0.0/16", tags={ "Name" : "vpc1"} ) vpc1=aws.ec2.Vpc( "vpc1",, vp1 ) typing this code work fine except vpc2=aws.ec2.Vpc( "vpc2" cidr_block="80.144.0.016" , tags={"Name" : "vpc2"}) not working and the cidr_block or tags not showing when you try to write code , any changing in typing code with pulumi?
l
@millions-parrot-88279 when using Python SDKs from Pulumi packages, every resource type has 2 constructors: • a constructor accepting 3 typed arguments: ◦
name
, which is a
string
args
, which is an object type
<ResourceType>Args
with all resource arguments fully typed ◦
opts
, which is an object with all Pulumi resource options fully typed • a constructor accepting
**kwargs
(keyword arguments). This constructor accepts every of the properties you find on the
<ResourceType>Args
When using Pulumi, you have full code assist when you use the first version of the constructor, which is not possible for the second type of constructors. So if you want code assist while writing Pulumi code, I suggest you use:
Copy code
vpc1=aws.ec2.Vpc(
  "vpc1",
  aws.ec2.VpcArgs(
    cidr_block="80.144.0.0/16", tags={ "Name" : "vpc1"}
  ),
)
m
thanks Ringo