dose anyone come with issue when using module for...
# general
m
dose anyone come with issue when using module for aws.ec2.Vpc() when attribute not working and when use a module aws.ec2.VpcArgs() all attribute work fine and other module that use Args will work fine except other as example aws.ec2.Vpc()?
l
What attribute isn't working?
And in what language?
m
in python
l
What attribute isn't working? Can you post a snippet (use Slack's "Text Snippet") of code that you expect to work but isn't. And if you like, you can post in #python, in case more people there might be able to help?
m
vpc2=aws.ec2.VpcArgs( cidr_block="" ) vpc1=aws.ec2.Vpc( "vpc1", )
not showing cidr block
l
That isn't valid code. You're not passing the args to the constructor.
Have you checked out the example code at https://www.pulumi.com/registry/packages/aws/api-docs/ec2/vpc/ ?
m
i mean in aws.ec2.Vpc() cant type cidrblock
l
Try
Copy code
aws.ec2.Vpc("main", cidr_block="10.0.0.0/16")
You need the name as the 1st parameter. The args go after that.
m
i did that many time no result
l
You'll need to post (in a Text Snippet some code that doesn't work but you expect to work. The code you posted works but does nothing.
m
vp1=aws.ec2.VpcArgs( cidr_block="80.146.0.0/16", tags={ "Name": "vp2" } ) vpc1=aws.ec2.Vpc("vpc1" , vp1)
i type a code like this and did pulumi preview and up . it work fine
l
Yes. And does this code work fine?
Copy code
vpc1=aws.ec2.Vpc("vpc1", cidr_block="80.146.0.0/16", tags={ "Name": "vp2" })
(Or whatever the correct Python syntax is)
m
as you typed a code , cidr_block and tags will not showing when wrting code
l
But do they work? Does the deployed VPC have the right name and CIDR block?
m
cant type cidr block or tags and not showing in python
l
That might be a problem with your IDE. Doesn't sound like it's Pulumi.
m
maybe so but i checked it , uninstall vs code and install again but same result along with python i did unistall it and again install using versuon 3.11.7 also same resullt.
l
My point is: ignore what the IDE says for now. You can sort that some other time, or ignore it. Worry about what the code actually does. Is it working? If not, can you figure out why?
m
the code working fine in this way now using pulumi preview or up vp1=aws.ec2.VpcArgs( cidr_block="80.144.0.0/16", tags={ "Name" : "vpc1"} ) vpc1=aws.ec2.Vpc( "vpc1",, vp1 )
you can test it
l
And presumably this works too:
Copy code
vpc1=aws.ec2.Vpc(
 "vpc1", aws.ec2.VpcArgs(
    cidr_block="80.144.0.0/16", tags={ "Name" : "vpc1"}
))
If you need help with Python syntax, you could try #python
m
thanks i will ask them