Skip to content

Commit

Permalink
Update more templates to used dictionary literals
Browse files Browse the repository at this point in the history
  • Loading branch information
julienp committed Aug 20, 2024
1 parent d1c1ed3 commit 44216eb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 37 deletions.
6 changes: 3 additions & 3 deletions azure-python/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
account = storage.StorageAccount(
"sa",
resource_group_name=resource_group.name,
sku=storage.SkuArgs(
name=storage.SkuName.STANDARD_LRS,
),
sku={
"name": storage.SkuName.STANDARD_LRS,
},
kind=storage.Kind.STORAGE_V2,
)

Expand Down
24 changes: 12 additions & 12 deletions civo-python/__main__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import pulumi
import pulumi_civo as civo

firewall = civo.Firewall("civo-firewall",
create_default_rules=True,
region='LON1')
firewall = civo.Firewall("civo-firewall", create_default_rules=True, region="LON1")

cluster = civo.KubernetesCluster('civo-k3s-cluster',
name='myFirstCivoCluster',
region='LON1',
firewall_id=firewall.id,
pools=civo.KubernetesClusterPoolsArgs(
node_count=3,
size="g4s.kube.medium",
))
cluster = civo.KubernetesCluster(
"civo-k3s-cluster",
name="myFirstCivoCluster",
region="LON1",
firewall_id=firewall.id,
pools={
"node_count": 3,
"size": "g4s.kube.medium",
},
)

pulumi.export('cluster_name', cluster.name)
pulumi.export("cluster_name", cluster.name)
4 changes: 2 additions & 2 deletions civo-python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pulumi==3.60.0
pulumi-civo==2.3.4
pulumi>=3.0.0,<4.0.0
pulumi-civo>=2,<3
39 changes: 19 additions & 20 deletions container-aws-python/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,34 @@
loadbalancer = awsx.lb.ApplicationLoadBalancer("loadbalancer")

# An ECR repository to store our application's container image
repo = awsx.ecr.Repository("repo", awsx.ecr.RepositoryArgs(
force_delete=True,
))
repo = awsx.ecr.Repository("repo", force_delete=True)

# Build and publish our application's container image from ./app to the ECR repository
image = awsx.ecr.Image(
"image",
repository_url=repo.url,
context="./app",
platform="linux/amd64")
"image", repository_url=repo.url, context="./app", platform="linux/amd64"
)

# Deploy an ECS Service on Fargate to host the application container
service = awsx.ecs.FargateService(
"service",
cluster=cluster.arn,
assign_public_ip=True,
task_definition_args=awsx.ecs.FargateServiceTaskDefinitionArgs(
container=awsx.ecs.TaskDefinitionContainerDefinitionArgs(
name="app",
image=image.image_uri,
cpu=cpu,
memory=memory,
essential=True,
port_mappings=[awsx.ecs.TaskDefinitionPortMappingArgs(
container_port=container_port,
target_group=loadbalancer.default_target_group,
)],
),
))
task_definition_args={
"container": {
"name": "app",
"image": image.image_uri,
"cpu": cpu,
"memory": memory,
"essential": True,
"port_mappings": [
{
"container_port": container_port,
"target_group": loadbalancer.default_target_group,
}
],
},
},
)

# The URL at which the container's HTTP endpoint will be available
export("url", Output.concat("http://", loadbalancer.load_balancer.dns_name))

0 comments on commit 44216eb

Please sign in to comment.