Hi All, I am following below How to guide <https:/...
# general
c
Hi All, I am following below How to guide https://www.pulumi.com/registry/packages/aws/how-to-guides/ec2-webserver/ Getting below error during pulumi up View Live: https://app.pulumi.com/pankajkrm/aws-webserver/aws-webserver/previews/9f05a381-36dd-4db7-892b-95ce27da7698 Type Name Plan Info + pulumipulumiStack aws-webserver-aws-webserver create 1 warning └─ awsec2SecurityGroup webserver-secgrp 1 error Diagnostics: awsec2SecurityGroup (webserver-secgrp): error: awsec2/securityGroupSecurityGroup resource 'webserver-secgrp' has a problem: Missing required argument: The argument "ingress.0.to_port" is required, but no definition was found.. Examine values at 'SecurityGroup.Ingresses'. pulumipulumiStack (aws-webserver-aws-webserver): warning: get_ami is deprecated: aws.getAmi has been deprecated in favor of aws.ec2.getAmi
b
please share your code
c
import pulumi import pulumi_aws as aws size = 't2.micro' ami = aws.get_ami(most_recent="true", owners=["137112412989"], filters=[{"name":"name","values":["amzn-ami-hvm-*"]}]) group = aws.ec2.SecurityGroup('webserver-secgrp',description='Enable HTTP access',ingress=[{ 'protocol': 'tcp', 'from_port': 22, 'to_port': 22, 'cidr_blocks': ['0.0.0.0/0']}]) server = aws.ec2.Instance('webserver-www', instance_type=size, vpc_security_group_ids=[group.id], # reference security group from above ami=ami.id) pulumi.export('publicIp', server.public_ip) pulumi.export('publicHostName', server.public_dns)
I am using the same code given in How to guide
e
I wonder if this works if you change to_port/from_port to toPort/fromPort?
c
same error: error: awsec2/securityGroupSecurityGroup resource 'webserver-secgrp' has a problem: Missing required argument: The argument "ingress.0.to_port" is required, but no definition was found.. Examine values at 'SecurityGroup.Ingresses'.
e
Oh wait, that error says "Ingresses" but your code says "ingress". Maybe the property should be "ingresses".
m
Hi @creamy-napkin-46533, I run the demo code and it works fine:
Copy code
View Live: <https://app.pulumi.com/dirien/aws-clasic-python/dev/updates/1>

     Type                      Name                   Status            Info
 +   pulumi:pulumi:Stack       aws-clasic-python-dev  created (41s)     1 warning
 +   ├─ aws:ec2:SecurityGroup  webserver-secgrp       created (2s)      
 +   └─ aws:ec2:Instance       webserver-www          created (32s)     


Diagnostics:
  pulumi:pulumi:Stack (aws-clasic-python-dev):
    warning: get_ami is deprecated: aws.getAmi has been deprecated in favor of aws.ec2.getAmi

Outputs:
    publicHostName: "<http://xxx.eu-central-1.compute.amazonaws.com|xxx.eu-central-1.compute.amazonaws.com>"
    publicIp      : "xxx"

Resources:
    + 3 created

Duration: 42s
I use python 3.10 and aws-classic 5.25.0
Maybe you can share your
pulumi about
c
it is working now
copy the code from git
m
Cool, glad to hear it worked!