https://pulumi.com logo
#general
Title
# general
m

millions-parrot-88279

12/19/2023, 7:11 PM
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

little-cartoon-10569

12/19/2023, 7:14 PM
What attribute isn't working?
And in what language?
m

millions-parrot-88279

12/19/2023, 7:15 PM
in python
l

little-cartoon-10569

12/19/2023, 7:20 PM
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

millions-parrot-88279

12/19/2023, 7:22 PM
vpc2=aws.ec2.VpcArgs( cidr_block="" ) vpc1=aws.ec2.Vpc( "vpc1", )
not showing cidr block
l

little-cartoon-10569

12/19/2023, 7:23 PM
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

millions-parrot-88279

12/19/2023, 7:24 PM
i mean in aws.ec2.Vpc() cant type cidrblock
l

little-cartoon-10569

12/19/2023, 7:24 PM
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

millions-parrot-88279

12/19/2023, 7:25 PM
i did that many time no result
l

little-cartoon-10569

12/19/2023, 7:26 PM
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

millions-parrot-88279

12/20/2023, 3:26 AM
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

little-cartoon-10569

12/20/2023, 3:41 AM
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

millions-parrot-88279

12/20/2023, 11:42 AM
as you typed a code , cidr_block and tags will not showing when wrting code
l

little-cartoon-10569

12/20/2023, 6:43 PM
But do they work? Does the deployed VPC have the right name and CIDR block?
m

millions-parrot-88279

12/21/2023, 12:29 AM
cant type cidr block or tags and not showing in python
l

little-cartoon-10569

12/21/2023, 12:34 AM
That might be a problem with your IDE. Doesn't sound like it's Pulumi.
m

millions-parrot-88279

12/21/2023, 3:13 AM
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

little-cartoon-10569

12/21/2023, 3:14 AM
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

millions-parrot-88279

12/21/2023, 3:19 AM
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

little-cartoon-10569

12/21/2023, 3:20 AM
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

millions-parrot-88279

12/21/2023, 3:23 AM
thanks i will ask them