From 44216eb395722bf1b7c144fe7e2ff5a972a11f2d Mon Sep 17 00:00:00 2001 From: "user.email" Date: Tue, 20 Aug 2024 15:37:22 +0200 Subject: [PATCH] Update more templates to used dictionary literals --- azure-python/__main__.py | 6 ++--- civo-python/__main__.py | 24 ++++++++++---------- civo-python/requirements.txt | 4 ++-- container-aws-python/__main__.py | 39 ++++++++++++++++---------------- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/azure-python/__main__.py b/azure-python/__main__.py index a0b28aa2f..c31e871d1 100644 --- a/azure-python/__main__.py +++ b/azure-python/__main__.py @@ -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, ) diff --git a/civo-python/__main__.py b/civo-python/__main__.py index cb1949574..2a39388c7 100644 --- a/civo-python/__main__.py +++ b/civo-python/__main__.py @@ -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) diff --git a/civo-python/requirements.txt b/civo-python/requirements.txt index 467f553d2..ffd7c6ef9 100644 --- a/civo-python/requirements.txt +++ b/civo-python/requirements.txt @@ -1,2 +1,2 @@ -pulumi==3.60.0 -pulumi-civo==2.3.4 +pulumi>=3.0.0,<4.0.0 +pulumi-civo>=2,<3 diff --git a/container-aws-python/__main__.py b/container-aws-python/__main__.py index 4532df3dc..22e9070ee 100644 --- a/container-aws-python/__main__.py +++ b/container-aws-python/__main__.py @@ -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))