forked from pulumi/pulumi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(pulumi-bot) Created local 'pkg/codegen/testing/test/testdata/transpi…
…led_examples' from remote 'pkg/tests/transpiled_examples'
- Loading branch information
aq17
committed
Oct 17, 2022
1 parent
1c5e9e8
commit b3cb210
Showing
59 changed files
with
2,135 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks/dotnet/MyStack.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Pulumi; | ||
using Aws = Pulumi.Aws; | ||
using Eks = Pulumi.Eks; | ||
|
||
class MyStack : Stack | ||
{ | ||
public MyStack() | ||
{ | ||
var vpcId = Output.Create(Aws.Ec2.GetVpc.InvokeAsync(new Aws.Ec2.GetVpcArgs | ||
{ | ||
Default = true, | ||
})).Apply(invoke => invoke.Id); | ||
var subnetIds = Output.Create(Aws.Ec2.GetSubnetIds.InvokeAsync(new Aws.Ec2.GetSubnetIdsArgs | ||
{ | ||
VpcId = vpcId, | ||
})).Apply(invoke => invoke.Ids); | ||
var cluster = new Eks.Cluster("cluster", new Eks.ClusterArgs | ||
{ | ||
VpcId = vpcId, | ||
SubnetIds = subnetIds, | ||
InstanceType = "t2.medium", | ||
DesiredCapacity = 2, | ||
MinSize = 1, | ||
MaxSize = 2, | ||
}); | ||
this.Kubeconfig = cluster.Kubeconfig; | ||
} | ||
|
||
[Output("kubeconfig")] | ||
public Output<string> Kubeconfig { get; set; } | ||
} |
31 changes: 31 additions & 0 deletions
31
pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks/go/main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2" | ||
"github.com/pulumi/pulumi-eks/sdk/go/eks" | ||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi" | ||
) | ||
|
||
func main() { | ||
pulumi.Run(func(ctx *pulumi.Context) error { | ||
vpcId := ec2.LookupVpc(ctx, map[string]interface{}{ | ||
"default": true, | ||
}, nil).Id | ||
subnetIds := ec2.GetSubnetIds(ctx, map[string]interface{}{ | ||
"vpcId": vpcId, | ||
}, nil).Ids | ||
cluster, err := eks.NewCluster(ctx, "cluster", &eks.ClusterArgs{ | ||
VpcId: pulumi.String(vpcId), | ||
SubnetIds: interface{}(subnetIds), | ||
InstanceType: pulumi.String("t2.medium"), | ||
DesiredCapacity: pulumi.Int(2), | ||
MinSize: pulumi.Int(1), | ||
MaxSize: pulumi.Int(2), | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
ctx.Export("kubeconfig", cluster.Kubeconfig) | ||
return nil | ||
}) | ||
} |
21 changes: 21 additions & 0 deletions
21
pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks/program.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
vpcId = invoke("aws:ec2/getVpc:getVpc", { | ||
default = true | ||
}).id | ||
subnetIds = invoke("aws:ec2/getSubnetIds:getSubnetIds", { | ||
vpcId = vpcId | ||
}).ids | ||
|
||
resource cluster "eks:index:Cluster" { | ||
__logicalName = "cluster" | ||
vpcId = vpcId | ||
subnetIds = subnetIds | ||
instanceType = "t2.medium" | ||
desiredCapacity = 2 | ||
minSize = 1 | ||
maxSize = 2 | ||
} | ||
|
||
output kubeconfig { | ||
__logicalName = "kubeconfig" | ||
value = cluster.kubeconfig | ||
} |
14 changes: 14 additions & 0 deletions
14
pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks/python/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pulumi | ||
import pulumi_aws as aws | ||
import pulumi_eks as eks | ||
|
||
vpc_id = aws.ec2.get_vpc().id | ||
subnet_ids = aws.ec2.get_subnet_ids().ids | ||
cluster = eks.Cluster("cluster", | ||
vpc_id=vpc_id, | ||
subnet_ids=subnet_ids, | ||
instance_type="t2.medium", | ||
desired_capacity=2, | ||
min_size=1, | ||
max_size=2) | ||
pulumi.export("kubeconfig", cluster.kubeconfig) |
38 changes: 38 additions & 0 deletions
38
pkg/codegen/testing/test/testdata/transpiled_examples/aws-static-website/program.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
resource siteBucket "aws-native:s3:Bucket" { | ||
__logicalName = "site-bucket" | ||
websiteConfiguration = { | ||
indexDocument = "index.html" | ||
} | ||
} | ||
|
||
resource indexHtml "aws:s3/bucketObject:BucketObject" { | ||
__logicalName = "index.html" | ||
bucket = siteBucket.id | ||
source = fileAsset("./www/index.html") | ||
acl = "public-read" | ||
contentType = "text/html" | ||
} | ||
|
||
resource faviconPng "aws:s3/bucketObject:BucketObject" { | ||
__logicalName = "favicon.png" | ||
bucket = siteBucket.id | ||
source = fileAsset("./www/favicon.png") | ||
acl = "public-read" | ||
contentType = "image/png" | ||
} | ||
|
||
resource bucketPolicy "aws:s3/bucketPolicy:BucketPolicy" { | ||
__logicalName = "bucketPolicy" | ||
bucket = siteBucket.id | ||
policy = "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": [\"s3:GetObject\"],\n \"Resource\": [\"${siteBucket.arn}/*\"]\n }\n ]\n}\n" | ||
} | ||
|
||
output bucketName { | ||
__logicalName = "bucketName" | ||
value = siteBucket.bucketName | ||
} | ||
|
||
output websiteUrl { | ||
__logicalName = "websiteUrl" | ||
value = siteBucket.websiteURL | ||
} |
33 changes: 33 additions & 0 deletions
33
pkg/codegen/testing/test/testdata/transpiled_examples/aws-static-website/python/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pulumi | ||
import pulumi_aws as aws | ||
import pulumi_aws_native as aws_native | ||
|
||
site_bucket = aws_native.s3.Bucket("site-bucket", website_configuration=aws_native.s3.BucketWebsiteConfigurationArgs( | ||
index_document="index.html", | ||
)) | ||
index_html = aws.s3.BucketObject("index.html", | ||
bucket=site_bucket.id, | ||
source=pulumi.FileAsset("./www/index.html"), | ||
acl="public-read", | ||
content_type="text/html") | ||
favicon_png = aws.s3.BucketObject("favicon.png", | ||
bucket=site_bucket.id, | ||
source=pulumi.FileAsset("./www/favicon.png"), | ||
acl="public-read", | ||
content_type="image/png") | ||
bucket_policy = aws.s3.BucketPolicy("bucketPolicy", | ||
bucket=site_bucket.id, | ||
policy=site_bucket.arn.apply(lambda arn: f"""{{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{{ | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": ["s3:GetObject"], | ||
"Resource": ["{arn}/*"] | ||
}} | ||
] | ||
}} | ||
""")) | ||
pulumi.export("bucketName", site_bucket.bucket_name) | ||
pulumi.export("websiteUrl", site_bucket.website_url) |
41 changes: 41 additions & 0 deletions
41
pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate/dotnet/MyStack.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Pulumi; | ||
using Aws = Pulumi.Aws; | ||
using Awsx = Pulumi.Awsx; | ||
|
||
class MyStack : Stack | ||
{ | ||
public MyStack() | ||
{ | ||
var cluster = new Aws.Ecs.Cluster("cluster", new Aws.Ecs.ClusterArgs | ||
{ | ||
}); | ||
var lb = new Awsx.Lb.ApplicationLoadBalancer("lb", new Awsx.Lb.ApplicationLoadBalancerArgs | ||
{ | ||
}); | ||
var nginx = new Awsx.Ecs.FargateService("nginx", new Awsx.Ecs.FargateServiceArgs | ||
{ | ||
Cluster = cluster.Arn, | ||
TaskDefinitionArgs = new Awsx.Ecs.Inputs.FargateServiceTaskDefinitionArgs | ||
{ | ||
Container = new Awsx.Ecs.Inputs.TaskDefinitionContainerDefinitionArgs | ||
{ | ||
Image = "nginx:latest", | ||
Cpu = 512, | ||
Memory = 128, | ||
PortMappings = | ||
{ | ||
new Awsx.Ecs.Inputs.TaskDefinitionPortMappingArgs | ||
{ | ||
ContainerPort = 80, | ||
TargetGroup = lb.DefaultTargetGroup, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
this.Url = lb.LoadBalancer.Apply(loadBalancer => loadBalancer.DnsName); | ||
} | ||
|
||
[Output("url")] | ||
public Output<string> Url { get; set; } | ||
} |
45 changes: 45 additions & 0 deletions
45
pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate/go/main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ecs" | ||
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/lb" | ||
"github.com/pulumi/pulumi-awsx/sdk/go/awsx/ecs" | ||
"github.com/pulumi/pulumi-awsx/sdk/go/awsx/lb" | ||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi" | ||
) | ||
|
||
func main() { | ||
pulumi.Run(func(ctx *pulumi.Context) error { | ||
cluster, err := ecs.NewCluster(ctx, "cluster", nil) | ||
if err != nil { | ||
return err | ||
} | ||
lb, err := lb.NewApplicationLoadBalancer(ctx, "lb", nil) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = ecs.NewFargateService(ctx, "nginx", &ecs.FargateServiceArgs{ | ||
Cluster: cluster.Arn, | ||
TaskDefinitionArgs: &ecs.FargateServiceTaskDefinitionArgs{ | ||
Container: &ecs.TaskDefinitionContainerDefinitionArgs{ | ||
Image: pulumi.String("nginx:latest"), | ||
Cpu: pulumi.Int(512), | ||
Memory: pulumi.Int(128), | ||
PortMappings: []ecs.TaskDefinitionPortMappingArgs{ | ||
&ecs.TaskDefinitionPortMappingArgs{ | ||
ContainerPort: pulumi.Int(80), | ||
TargetGroup: lb.DefaultTargetGroup, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
ctx.Export("url", lb.LoadBalancer.ApplyT(func(loadBalancer *lb.LoadBalancer) (string, error) { | ||
return loadBalancer.DnsName, nil | ||
}).(pulumi.StringOutput)) | ||
return nil | ||
}) | ||
} |
21 changes: 21 additions & 0 deletions
21
pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate/nodejs/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as aws from "@pulumi/aws"; | ||
import * as awsx from "@pulumi/awsx"; | ||
|
||
const cluster = new aws.ecs.Cluster("cluster", {}); | ||
const lb = new awsx.lb.ApplicationLoadBalancer("lb", {}); | ||
const nginx = new awsx.ecs.FargateService("nginx", { | ||
cluster: cluster.arn, | ||
taskDefinitionArgs: { | ||
container: { | ||
image: "nginx:latest", | ||
cpu: 512, | ||
memory: 128, | ||
portMappings: [{ | ||
containerPort: 80, | ||
targetGroup: lb.defaultTargetGroup, | ||
}], | ||
}, | ||
}, | ||
}); | ||
export const url = lb.loadBalancer.dnsName; |
28 changes: 28 additions & 0 deletions
28
pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate/program.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
resource cluster "aws:ecs/cluster:Cluster" { | ||
__logicalName = "cluster" | ||
} | ||
|
||
resource lb "awsx:lb:ApplicationLoadBalancer" { | ||
__logicalName = "lb" | ||
} | ||
|
||
resource nginx "awsx:ecs:FargateService" { | ||
__logicalName = "nginx" | ||
cluster = cluster.arn | ||
taskDefinitionArgs = { | ||
container = { | ||
image = "nginx:latest", | ||
cpu = 512, | ||
memory = 128, | ||
portMappings = [{ | ||
containerPort = 80, | ||
targetGroup = lb.defaultTargetGroup | ||
}] | ||
} | ||
} | ||
} | ||
|
||
output url { | ||
__logicalName = "url" | ||
value = lb.loadBalancer.dnsName | ||
} |
20 changes: 20 additions & 0 deletions
20
pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate/python/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pulumi | ||
import pulumi_aws as aws | ||
import pulumi_awsx as awsx | ||
|
||
cluster = aws.ecs.Cluster("cluster") | ||
lb = awsx.lb.ApplicationLoadBalancer("lb") | ||
nginx = awsx.ecs.FargateService("nginx", | ||
cluster=cluster.arn, | ||
task_definition_args=awsx.ecs.FargateServiceTaskDefinitionArgs( | ||
container=awsx.ecs.TaskDefinitionContainerDefinitionArgs( | ||
image="nginx:latest", | ||
cpu=512, | ||
memory=128, | ||
port_mappings=[awsx.ecs.TaskDefinitionPortMappingArgs( | ||
container_port=80, | ||
target_group=lb.default_target_group, | ||
)], | ||
), | ||
)) | ||
pulumi.export("url", lb.load_balancer.dns_name) |
Oops, something went wrong.