pulumi/pkg/codegen/internal/test/testdata/aws-webserver.pp.py
Pat Gavlin 1d672563da Fix output property names in Python codegen.
Some property names are mapped from their `camelCase` Pulumi name to a
`snake_case` Python name. This mapping is irregular, and only occurs for
resources properties and function calls.

Note that there's still more work to do here: this only fixes names on
the output side; the input side is still broken for nested resource
proprerties and function calls.

The underlying design--annotated types in `hcl2/model`--may need some
additional work in the future, but I _believe_ it's good enough for now.
2020-04-21 10:25:27 -07:00

32 lines
874 B
Python

import pulumi
import pulumi_aws as aws
# Create a new security group for port 80.
security_group = aws.ec2.SecurityGroup("securityGroup", ingress=[{
"protocol": "tcp",
"fromPort": 0,
"toPort": 0,
"cidrBlocks": ["0.0.0.0/0"],
}])
ami = aws.get_ami({
"filters": [{
"name": "name",
"values": ["amzn-ami-hvm-*-x86_64-ebs"],
}],
"owners": ["137112412989"],
"mostRecent": True,
})
# Create a simple web server using the startup script for the instance.
server = aws.ec2.Instance("server",
tags={
"Name": "web-server-www",
},
instance_type="t2.micro",
security_groups=[security_group.name],
ami=ami.id,
user_data="""#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &
""")
pulumi.export("publicIp", server.public_ip)
pulumi.export("publicHostName", server.public_dns)