github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/transpiled_examples/webserver-json-pp/webserver-json.pp (about)

     1  config instanceType string {
     2  	__logicalName = "InstanceType"
     3  	default = "t3.micro"
     4  }
     5  
     6  resource webSecGrp "aws:ec2/securityGroup:SecurityGroup" {
     7  	__logicalName = "WebSecGrp"
     8  	ingress = [{
     9  		protocol = "tcp",
    10  		fromPort = 80,
    11  		toPort = 80,
    12  		cidrBlocks = ["0.0.0.0/0"]
    13  	}]
    14  
    15  	options {
    16  		version = "4.37.1"
    17  	}
    18  }
    19  
    20  resource webServer "aws:ec2/instance:Instance" {
    21  	__logicalName = "WebServer"
    22  	instanceType = instanceType
    23  	ami = invoke("aws:index/getAmi:getAmi", {
    24  		filters = [{
    25  			name = "name",
    26  			values = ["amzn-ami-hvm-*-x86_64-ebs"]
    27  		}],
    28  		owners = ["137112412989"],
    29  		mostRecent = true
    30  	}).id
    31  	userData = join("\n", [
    32  		"#!/bin/bash",
    33  		"echo 'Hello, World from ${webSecGrp.arn}!' > index.html",
    34  		"nohup python -m SimpleHTTPServer 80 &"
    35  	])
    36  	vpcSecurityGroupIds = [webSecGrp.id]
    37  
    38  	options {
    39  		version = "4.37.1"
    40  	}
    41  }
    42  
    43  output instanceId {
    44  	__logicalName = "InstanceId"
    45  	value = webServer.id
    46  }
    47  
    48  output publicIp {
    49  	__logicalName = "PublicIp"
    50  	value = webServer.publicIp
    51  }
    52  
    53  output publicHostName {
    54  	__logicalName = "PublicHostName"
    55  	value = webServer.publicDns
    56  }