1. Packages
  2. Packages
  3. Defang Providers
  4. API Docs
  5. Service
Viewing docs for Defang GCP v2.4.1
published on Saturday, Jul 11, 2026 by Defang
defang-gcp logo
Viewing docs for Defang GCP v2.4.1
published on Saturday, Jul 11, 2026 by Defang

    Create Service Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Service(name: string, args: ServiceArgs, opts?: ComponentResourceOptions);
    @overload
    def Service(resource_name: str,
                args: ServiceArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Service(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                image: Optional[str] = None,
                project_name: Optional[str] = None,
                platform: Optional[str] = None,
                ports: Optional[Sequence[_compose.ServicePortConfigArgs]] = None,
                domain_name: Optional[str] = None,
                entrypoint: Optional[Sequence[str]] = None,
                environment: Optional[Mapping[str, str]] = None,
                health_check: Optional[_compose.HealthCheckConfigArgs] = None,
                depends_on: Optional[Mapping[str, _compose.ServiceDependencyArgs]] = None,
                llm: Optional[_compose.LlmConfigArgs] = None,
                command: Optional[Sequence[str]] = None,
                deploy: Optional[_compose.DeployConfigArgs] = None,
                container_name: Optional[str] = None,
                service_account_email: Optional[str] = None,
                sidecars: Optional[Mapping[str, _compose.ServiceConfigArgs]] = None,
                stop_grace_period: Optional[str] = None,
                triggers: Optional[Mapping[str, str]] = None,
                volumes: Optional[Sequence[_compose.ServiceVolumeConfigArgs]] = None,
                volumes_from: Optional[Sequence[str]] = None,
                working_dir: Optional[str] = None)
    func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
    public Service(string name, ServiceArgs args, ComponentResourceOptions? opts = null)
    public Service(String name, ServiceArgs args)
    public Service(String name, ServiceArgs args, ComponentResourceOptions options)
    
    type: defang-gcp:Service
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "defang-gcp_service" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    options ComponentResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var serviceResource = new DefangGcp.Service("serviceResource", new()
    {
        Image = "string",
        ProjectName = "string",
        Platform = "string",
        Ports = new[]
        {
            new DefangGcp.Compose.Inputs.ServicePortConfigArgs
            {
                Target = 0,
                AppProtocol = "string",
                Listener = "string",
                Mode = "string",
                Protocol = "string",
            },
        },
        DomainName = "string",
        Entrypoint = new[]
        {
            "string",
        },
        Environment = 
        {
            { "string", "string" },
        },
        HealthCheck = new DefangGcp.Compose.Inputs.HealthCheckConfigArgs
        {
            IntervalSeconds = 0,
            Retries = 0,
            StartPeriodSeconds = 0,
            Test = new[]
            {
                "string",
            },
            TimeoutSeconds = 0,
        },
        DependsOn = 
        {
            { "string", new DefangGcp.Compose.Inputs.ServiceDependencyArgs
            {
                Condition = "string",
                Required = false,
            } },
        },
        Llm = null,
        Command = new[]
        {
            "string",
        },
        Deploy = new DefangGcp.Compose.Inputs.DeployConfigArgs
        {
            Replicas = 0,
            Resources = new DefangGcp.Compose.Inputs.ResourcesArgs
            {
                Reservations = new DefangGcp.Compose.Inputs.ResourceConfigArgs
                {
                    Cpus = 0,
                    Memory = "string",
                },
            },
        },
        ContainerName = "string",
        ServiceAccountEmail = "string",
        Sidecars = 
        {
            { "string", new DefangGcp.Compose.Inputs.ServiceConfigArgs
            {
                Autoscaling = false,
                Build = new DefangGcp.Compose.Inputs.BuildConfigArgs
                {
                    Context = "string",
                    Args = 
                    {
                        { "string", "string" },
                    },
                    CacheFrom = new[]
                    {
                        "string",
                    },
                    CacheTo = new[]
                    {
                        "string",
                    },
                    Dockerfile = "string",
                    Platforms = new[]
                    {
                        "string",
                    },
                    ShmSize = "string",
                    Target = "string",
                },
                Command = new[]
                {
                    "string",
                },
                ContainerName = "string",
                DependsOn = 
                {
                    { "string", new DefangGcp.Compose.Inputs.ServiceDependencyArgs
                    {
                        Condition = "string",
                        Required = false,
                    } },
                },
                Deploy = new DefangGcp.Compose.Inputs.DeployConfigArgs
                {
                    Replicas = 0,
                    Resources = new DefangGcp.Compose.Inputs.ResourcesArgs
                    {
                        Reservations = new DefangGcp.Compose.Inputs.ResourceConfigArgs
                        {
                            Cpus = 0,
                            Memory = "string",
                        },
                    },
                },
                DomainName = "string",
                Entrypoint = new[]
                {
                    "string",
                },
                Environment = 
                {
                    { "string", "string" },
                },
                HealthCheck = new DefangGcp.Compose.Inputs.HealthCheckConfigArgs
                {
                    IntervalSeconds = 0,
                    Retries = 0,
                    StartPeriodSeconds = 0,
                    Test = new[]
                    {
                        "string",
                    },
                    TimeoutSeconds = 0,
                },
                Image = "string",
                Llm = null,
                NetworkMode = "string",
                Networks = 
                {
                    { "string", new DefangGcp.Compose.Inputs.ServiceNetworkConfigArgs
                    {
                        Aliases = new[]
                        {
                            "string",
                        },
                    } },
                },
                Platform = "string",
                Policies = new[]
                {
                    "string",
                },
                Ports = new[]
                {
                    new DefangGcp.Compose.Inputs.ServicePortConfigArgs
                    {
                        Target = 0,
                        AppProtocol = "string",
                        Listener = "string",
                        Mode = "string",
                        Protocol = "string",
                    },
                },
                Postgres = new DefangGcp.Compose.Inputs.PostgresConfigArgs
                {
                    AllowDowntime = false,
                    FromSnapshot = "string",
                },
                Redis = new DefangGcp.Compose.Inputs.RedisConfigArgs
                {
                    AllowDowntime = false,
                    FromSnapshot = "string",
                },
                Restart = "string",
                StopGracePeriod = "string",
                Volumes = new[]
                {
                    new DefangGcp.Compose.Inputs.ServiceVolumeConfigArgs
                    {
                        Source = "string",
                        Target = "string",
                        ReadOnly = false,
                    },
                },
                VolumesFrom = new[]
                {
                    "string",
                },
                WorkingDir = "string",
            } },
        },
        StopGracePeriod = "string",
        Triggers = 
        {
            { "string", "string" },
        },
        Volumes = new[]
        {
            new DefangGcp.Compose.Inputs.ServiceVolumeConfigArgs
            {
                Source = "string",
                Target = "string",
                ReadOnly = false,
            },
        },
        VolumesFrom = new[]
        {
            "string",
        },
        WorkingDir = "string",
    });
    
    example, err := defanggcp.NewService(ctx, "serviceResource", &defanggcp.ServiceArgs{
    	Image:       pulumi.String("string"),
    	ProjectName: "string",
    	Platform:    "string",
    	Ports: compose.ServicePortConfigArray{
    		&compose.ServicePortConfigArgs{
    			Target:      pulumi.Int(0),
    			AppProtocol: pulumi.String("string"),
    			Listener:    pulumi.String("string"),
    			Mode:        pulumi.String("string"),
    			Protocol:    pulumi.String("string"),
    		},
    	},
    	DomainName: "string",
    	Entrypoint: pulumi.StringArray{
    		"string",
    	},
    	Environment: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	HealthCheck: &compose.HealthCheckConfigArgs{
    		IntervalSeconds:    pulumi.Int(0),
    		Retries:            pulumi.Int(0),
    		StartPeriodSeconds: pulumi.Int(0),
    		Test: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		TimeoutSeconds: pulumi.Int(0),
    	},
    	DependsOn: compose.ServiceDependencyMap{
    		"string": &compose.ServiceDependencyArgs{
    			Condition: pulumi.String("string"),
    			Required:  pulumi.Bool(false),
    		},
    	},
    	Llm: &compose.LlmConfigArgs{},
    	Command: pulumi.StringArray{
    		"string",
    	},
    	Deploy: &compose.DeployConfigArgs{
    		Replicas: pulumi.Int(0),
    		Resources: &compose.ResourcesArgs{
    			Reservations: &compose.ResourceConfigArgs{
    				Cpus:   pulumi.Float64(0),
    				Memory: pulumi.String("string"),
    			},
    		},
    	},
    	ContainerName:       "string",
    	ServiceAccountEmail: pulumi.String("string"),
    	Sidecars: compose.ServiceConfigMap{
    		"string": &compose.ServiceConfigArgs{
    			Autoscaling: pulumi.Bool(false),
    			Build: &compose.BuildConfigArgs{
    				Context: pulumi.String("string"),
    				Args: pulumi.StringMap{
    					"string": pulumi.String("string"),
    				},
    				CacheFrom: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				CacheTo: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				Dockerfile: pulumi.String("string"),
    				Platforms: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				ShmSize: pulumi.String("string"),
    				Target:  pulumi.String("string"),
    			},
    			Command: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			ContainerName: pulumi.String("string"),
    			DependsOn: compose.ServiceDependencyMap{
    				"string": &compose.ServiceDependencyArgs{
    					Condition: pulumi.String("string"),
    					Required:  pulumi.Bool(false),
    				},
    			},
    			Deploy: &compose.DeployConfigArgs{
    				Replicas: pulumi.Int(0),
    				Resources: &compose.ResourcesArgs{
    					Reservations: &compose.ResourceConfigArgs{
    						Cpus:   pulumi.Float64(0),
    						Memory: pulumi.String("string"),
    					},
    				},
    			},
    			DomainName: pulumi.String("string"),
    			Entrypoint: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Environment: pulumi.StringMap{
    				"string": pulumi.String("string"),
    			},
    			HealthCheck: &compose.HealthCheckConfigArgs{
    				IntervalSeconds:    pulumi.Int(0),
    				Retries:            pulumi.Int(0),
    				StartPeriodSeconds: pulumi.Int(0),
    				Test: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				TimeoutSeconds: pulumi.Int(0),
    			},
    			Image:       pulumi.String("string"),
    			Llm:         &compose.LlmConfigArgs{},
    			NetworkMode: pulumi.String("string"),
    			Networks: compose.ServiceNetworkConfigMap{
    				"string": &compose.ServiceNetworkConfigArgs{
    					Aliases: pulumi.StringArray{
    						pulumi.String("string"),
    					},
    				},
    			},
    			Platform: pulumi.String("string"),
    			Policies: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Ports: compose.ServicePortConfigArray{
    				&compose.ServicePortConfigArgs{
    					Target:      pulumi.Int(0),
    					AppProtocol: pulumi.String("string"),
    					Listener:    pulumi.String("string"),
    					Mode:        pulumi.String("string"),
    					Protocol:    pulumi.String("string"),
    				},
    			},
    			Postgres: &compose.PostgresConfigArgs{
    				AllowDowntime: pulumi.Bool(false),
    				FromSnapshot:  pulumi.String("string"),
    			},
    			Redis: &compose.RedisConfigArgs{
    				AllowDowntime: pulumi.Bool(false),
    				FromSnapshot:  pulumi.String("string"),
    			},
    			Restart:         pulumi.String("string"),
    			StopGracePeriod: pulumi.String("string"),
    			Volumes: compose.ServiceVolumeConfigArray{
    				&compose.ServiceVolumeConfigArgs{
    					Source:   pulumi.String("string"),
    					Target:   pulumi.String("string"),
    					ReadOnly: pulumi.Bool(false),
    				},
    			},
    			VolumesFrom: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			WorkingDir: pulumi.String("string"),
    		},
    	},
    	StopGracePeriod: "string",
    	Triggers: pulumi.StringMap{
    		"string": "string",
    	},
    	Volumes: compose.ServiceVolumeConfigArray{
    		&compose.ServiceVolumeConfigArgs{
    			Source:   pulumi.String("string"),
    			Target:   pulumi.String("string"),
    			ReadOnly: pulumi.Bool(false),
    		},
    	},
    	VolumesFrom: pulumi.StringArray{
    		"string",
    	},
    	WorkingDir: "string",
    })
    
    resource "defang-gcp_service" "serviceResource" {
      image        = "string"
      project_name = "string"
      platform     = "string"
      ports {
        target       = 0
        app_protocol = "string"
        listener     = "string"
        mode         = "string"
        protocol     = "string"
      }
      domain_name = "string"
      entrypoint  = ["string"]
      environment = {
        "string" = "string"
      }
      health_check = {
        interval_seconds     = 0
        retries              = 0
        start_period_seconds = 0
        test                 = ["string"]
        timeout_seconds      = 0
      }
      depends_on = {
        "string" = {
          condition = "string"
          required  = false
        }
      }
      llm     = {}
      command = ["string"]
      deploy = {
        replicas = 0
        resources = {
          reservations = {
            cpus   = 0
            memory = "string"
          }
        }
      }
      container_name        = "string"
      service_account_email = "string"
      sidecars = {
        "string" = {
          autoscaling = false
          build = {
            context = "string"
            args = {
              "string" = "string"
            }
            cache_from = ["string"]
            cache_to   = ["string"]
            dockerfile = "string"
            platforms  = ["string"]
            shm_size   = "string"
            target     = "string"
          }
          command        = ["string"]
          container_name = "string"
          depends_on = {
            "string" = {
              condition = "string"
              required  = false
            }
          }
          deploy = {
            replicas = 0
            resources = {
              reservations = {
                cpus   = 0
                memory = "string"
              }
            }
          }
          domain_name = "string"
          entrypoint  = ["string"]
          environment = {
            "string" = "string"
          }
          health_check = {
            interval_seconds     = 0
            retries              = 0
            start_period_seconds = 0
            test                 = ["string"]
            timeout_seconds      = 0
          }
          image        = "string"
          llm          = {}
          network_mode = "string"
          networks = {
            "string" = {
              aliases = ["string"]
            }
          }
          platform = "string"
          policies = ["string"]
          ports = [{
            "target"      = 0
            "appProtocol" = "string"
            "listener"    = "string"
            "mode"        = "string"
            "protocol"    = "string"
          }]
          postgres = {
            allow_downtime = false
            from_snapshot  = "string"
          }
          redis = {
            allow_downtime = false
            from_snapshot  = "string"
          }
          restart           = "string"
          stop_grace_period = "string"
          volumes = [{
            "source"   = "string"
            "target"   = "string"
            "readOnly" = false
          }]
          volumes_from = ["string"]
          working_dir  = "string"
        }
      }
      stop_grace_period = "string"
      triggers = {
        "string" = "string"
      }
      volumes {
        source    = "string"
        target    = "string"
        read_only = false
      }
      volumes_from = ["string"]
      working_dir  = "string"
    }
    
    var serviceResource = new Service("serviceResource", ServiceArgs.builder()
        .image("string")
        .projectName("string")
        .platform("string")
        .ports(ServicePortConfigArgs.builder()
            .target(0)
            .appProtocol("string")
            .listener("string")
            .mode("string")
            .protocol("string")
            .build())
        .domainName("string")
        .entrypoint("string")
        .environment(Map.of("string", "string"))
        .healthCheck(HealthCheckConfigArgs.builder()
            .intervalSeconds(0)
            .retries(0)
            .startPeriodSeconds(0)
            .test("string")
            .timeoutSeconds(0)
            .build())
        .dependsOn(Map.of("string", ServiceDependencyArgs.builder()
            .condition("string")
            .required(false)
            .build()))
        .llm(LlmConfigArgs.builder()
            .build())
        .command("string")
        .deploy(DeployConfigArgs.builder()
            .replicas(0)
            .resources(ResourcesArgs.builder()
                .reservations(ResourceConfigArgs.builder()
                    .cpus(0.0)
                    .memory("string")
                    .build())
                .build())
            .build())
        .containerName("string")
        .serviceAccountEmail("string")
        .sidecars(Map.of("string", ServiceConfigArgs.builder()
            .autoscaling(false)
            .build(BuildConfigArgs.builder()
                .context("string")
                .args(Map.of("string", "string"))
                .cacheFrom("string")
                .cacheTo("string")
                .dockerfile("string")
                .platforms("string")
                .shmSize("string")
                .target("string")
                .build())
            .command("string")
            .containerName("string")
            .dependsOn(Map.of("string", ServiceDependencyArgs.builder()
                .condition("string")
                .required(false)
                .build()))
            .deploy(DeployConfigArgs.builder()
                .replicas(0)
                .resources(ResourcesArgs.builder()
                    .reservations(ResourceConfigArgs.builder()
                        .cpus(0.0)
                        .memory("string")
                        .build())
                    .build())
                .build())
            .domainName("string")
            .entrypoint("string")
            .environment(Map.of("string", "string"))
            .healthCheck(HealthCheckConfigArgs.builder()
                .intervalSeconds(0)
                .retries(0)
                .startPeriodSeconds(0)
                .test("string")
                .timeoutSeconds(0)
                .build())
            .image("string")
            .llm(LlmConfigArgs.builder()
                .build())
            .networkMode("string")
            .networks(Map.of("string", ServiceNetworkConfigArgs.builder()
                .aliases("string")
                .build()))
            .platform("string")
            .policies("string")
            .ports(ServicePortConfigArgs.builder()
                .target(0)
                .appProtocol("string")
                .listener("string")
                .mode("string")
                .protocol("string")
                .build())
            .postgres(PostgresConfigArgs.builder()
                .allowDowntime(false)
                .fromSnapshot("string")
                .build())
            .redis(RedisConfigArgs.builder()
                .allowDowntime(false)
                .fromSnapshot("string")
                .build())
            .restart("string")
            .stopGracePeriod("string")
            .volumes(ServiceVolumeConfigArgs.builder()
                .source("string")
                .target("string")
                .readOnly(false)
                .build())
            .volumesFrom("string")
            .workingDir("string")
            .build()))
        .stopGracePeriod("string")
        .triggers(Map.of("string", "string"))
        .volumes(ServiceVolumeConfigArgs.builder()
            .source("string")
            .target("string")
            .readOnly(false)
            .build())
        .volumesFrom("string")
        .workingDir("string")
        .build());
    
    service_resource = defang_gcp.Service("serviceResource",
        image="string",
        project_name="string",
        platform="string",
        ports=[{
            "target": 0,
            "app_protocol": "string",
            "listener": "string",
            "mode": "string",
            "protocol": "string",
        }],
        domain_name="string",
        entrypoint=["string"],
        environment={
            "string": "string",
        },
        health_check={
            "interval_seconds": 0,
            "retries": 0,
            "start_period_seconds": 0,
            "test": ["string"],
            "timeout_seconds": 0,
        },
        depends_on={
            "string": {
                "condition": "string",
                "required": False,
            },
        },
        llm={},
        command=["string"],
        deploy={
            "replicas": 0,
            "resources": {
                "reservations": {
                    "cpus": float(0),
                    "memory": "string",
                },
            },
        },
        container_name="string",
        service_account_email="string",
        sidecars={
            "string": {
                "autoscaling": False,
                "build": {
                    "context": "string",
                    "args": {
                        "string": "string",
                    },
                    "cache_from": ["string"],
                    "cache_to": ["string"],
                    "dockerfile": "string",
                    "platforms": ["string"],
                    "shm_size": "string",
                    "target": "string",
                },
                "command": ["string"],
                "container_name": "string",
                "depends_on": {
                    "string": {
                        "condition": "string",
                        "required": False,
                    },
                },
                "deploy": {
                    "replicas": 0,
                    "resources": {
                        "reservations": {
                            "cpus": float(0),
                            "memory": "string",
                        },
                    },
                },
                "domain_name": "string",
                "entrypoint": ["string"],
                "environment": {
                    "string": "string",
                },
                "health_check": {
                    "interval_seconds": 0,
                    "retries": 0,
                    "start_period_seconds": 0,
                    "test": ["string"],
                    "timeout_seconds": 0,
                },
                "image": "string",
                "llm": {},
                "network_mode": "string",
                "networks": {
                    "string": {
                        "aliases": ["string"],
                    },
                },
                "platform": "string",
                "policies": ["string"],
                "ports": [{
                    "target": 0,
                    "app_protocol": "string",
                    "listener": "string",
                    "mode": "string",
                    "protocol": "string",
                }],
                "postgres": {
                    "allow_downtime": False,
                    "from_snapshot": "string",
                },
                "redis": {
                    "allow_downtime": False,
                    "from_snapshot": "string",
                },
                "restart": "string",
                "stop_grace_period": "string",
                "volumes": [{
                    "source": "string",
                    "target": "string",
                    "read_only": False,
                }],
                "volumes_from": ["string"],
                "working_dir": "string",
            },
        },
        stop_grace_period="string",
        triggers={
            "string": "string",
        },
        volumes=[{
            "source": "string",
            "target": "string",
            "read_only": False,
        }],
        volumes_from=["string"],
        working_dir="string")
    
    const serviceResource = new defang_gcp.Service("serviceResource", {
        image: "string",
        projectName: "string",
        platform: "string",
        ports: [{
            target: 0,
            appProtocol: "string",
            listener: "string",
            mode: "string",
            protocol: "string",
        }],
        domainName: "string",
        entrypoint: ["string"],
        environment: {
            string: "string",
        },
        healthCheck: {
            intervalSeconds: 0,
            retries: 0,
            startPeriodSeconds: 0,
            test: ["string"],
            timeoutSeconds: 0,
        },
        dependsOn: {
            string: {
                condition: "string",
                required: false,
            },
        },
        llm: {},
        command: ["string"],
        deploy: {
            replicas: 0,
            resources: {
                reservations: {
                    cpus: 0,
                    memory: "string",
                },
            },
        },
        containerName: "string",
        serviceAccountEmail: "string",
        sidecars: {
            string: {
                autoscaling: false,
                build: {
                    context: "string",
                    args: {
                        string: "string",
                    },
                    cacheFrom: ["string"],
                    cacheTo: ["string"],
                    dockerfile: "string",
                    platforms: ["string"],
                    shmSize: "string",
                    target: "string",
                },
                command: ["string"],
                containerName: "string",
                dependsOn: {
                    string: {
                        condition: "string",
                        required: false,
                    },
                },
                deploy: {
                    replicas: 0,
                    resources: {
                        reservations: {
                            cpus: 0,
                            memory: "string",
                        },
                    },
                },
                domainName: "string",
                entrypoint: ["string"],
                environment: {
                    string: "string",
                },
                healthCheck: {
                    intervalSeconds: 0,
                    retries: 0,
                    startPeriodSeconds: 0,
                    test: ["string"],
                    timeoutSeconds: 0,
                },
                image: "string",
                llm: {},
                networkMode: "string",
                networks: {
                    string: {
                        aliases: ["string"],
                    },
                },
                platform: "string",
                policies: ["string"],
                ports: [{
                    target: 0,
                    appProtocol: "string",
                    listener: "string",
                    mode: "string",
                    protocol: "string",
                }],
                postgres: {
                    allowDowntime: false,
                    fromSnapshot: "string",
                },
                redis: {
                    allowDowntime: false,
                    fromSnapshot: "string",
                },
                restart: "string",
                stopGracePeriod: "string",
                volumes: [{
                    source: "string",
                    target: "string",
                    readOnly: false,
                }],
                volumesFrom: ["string"],
                workingDir: "string",
            },
        },
        stopGracePeriod: "string",
        triggers: {
            string: "string",
        },
        volumes: [{
            source: "string",
            target: "string",
            readOnly: false,
        }],
        volumesFrom: ["string"],
        workingDir: "string",
    });
    
    type: defang-gcp:Service
    properties:
        command:
            - string
        containerName: string
        dependsOn:
            string:
                condition: string
                required: false
        deploy:
            replicas: 0
            resources:
                reservations:
                    cpus: 0
                    memory: string
        domainName: string
        entrypoint:
            - string
        environment:
            string: string
        healthCheck:
            intervalSeconds: 0
            retries: 0
            startPeriodSeconds: 0
            test:
                - string
            timeoutSeconds: 0
        image: string
        llm: {}
        platform: string
        ports:
            - appProtocol: string
              listener: string
              mode: string
              protocol: string
              target: 0
        projectName: string
        serviceAccountEmail: string
        sidecars:
            string:
                autoscaling: false
                build:
                    args:
                        string: string
                    cacheFrom:
                        - string
                    cacheTo:
                        - string
                    context: string
                    dockerfile: string
                    platforms:
                        - string
                    shmSize: string
                    target: string
                command:
                    - string
                containerName: string
                dependsOn:
                    string:
                        condition: string
                        required: false
                deploy:
                    replicas: 0
                    resources:
                        reservations:
                            cpus: 0
                            memory: string
                domainName: string
                entrypoint:
                    - string
                environment:
                    string: string
                healthCheck:
                    intervalSeconds: 0
                    retries: 0
                    startPeriodSeconds: 0
                    test:
                        - string
                    timeoutSeconds: 0
                image: string
                llm: {}
                networkMode: string
                networks:
                    string:
                        aliases:
                            - string
                platform: string
                policies:
                    - string
                ports:
                    - appProtocol: string
                      listener: string
                      mode: string
                      protocol: string
                      target: 0
                postgres:
                    allowDowntime: false
                    fromSnapshot: string
                redis:
                    allowDowntime: false
                    fromSnapshot: string
                restart: string
                stopGracePeriod: string
                volumes:
                    - readOnly: false
                      source: string
                      target: string
                volumesFrom:
                    - string
                workingDir: string
        stopGracePeriod: string
        triggers:
            string: string
        volumes:
            - readOnly: false
              source: string
              target: string
        volumesFrom:
            - string
        workingDir: string
    

    Service Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Service resource accepts the following input properties:

    Image string
    ProjectName string
    Command List<string>
    ContainerName string
    DependsOn Dictionary<string, DefangLabs.DefangGcp.Compose.Inputs.ServiceDependencyArgs>
    Deploy DefangLabs.DefangGcp.Compose.Inputs.DeployConfig
    DomainName string
    Entrypoint List<string>
    Environment Dictionary<string, string>
    HealthCheck DefangLabs.DefangGcp.Compose.Inputs.HealthCheckConfig
    Llm DefangLabs.DefangGcp.Compose.Inputs.LlmConfig
    Platform string
    Ports List<DefangLabs.DefangGcp.Compose.Inputs.ServicePortConfig>
    ServiceAccountEmail string
    Sidecars Dictionary<string, DefangLabs.DefangGcp.Compose.Inputs.ServiceConfigArgs>
    StopGracePeriod string
    Triggers Dictionary<string, string>
    Volumes List<DefangLabs.DefangGcp.Compose.Inputs.ServiceVolumeConfig>
    VolumesFrom List<string>
    WorkingDir string
    image String
    projectName String
    command List<String>
    containerName String
    dependsOn Map<String,ServiceDependencyArgs>
    deploy DeployConfig
    domainName String
    entrypoint List<String>
    environment Map<String,String>
    healthCheck HealthCheckConfig
    llm LlmConfig
    platform String
    ports List<ServicePortConfig>
    serviceAccountEmail String
    sidecars Map<String,ServiceConfigArgs>
    stopGracePeriod String
    triggers Map<String,String>
    volumes List<ServiceVolumeConfig>
    volumesFrom List<String>
    workingDir String
    image string
    projectName string
    command string[]
    containerName string
    dependsOn {[key: string]: composeServiceDependencyArgs}
    deploy composeDeployConfig
    domainName string
    entrypoint string[]
    environment {[key: string]: string}
    healthCheck composeHealthCheckConfig
    llm composeLlmConfig
    platform string
    ports composeServicePortConfig[]
    serviceAccountEmail string
    sidecars {[key: string]: composeServiceConfigArgs}
    stopGracePeriod string
    triggers {[key: string]: string}
    volumes composeServiceVolumeConfig[]
    volumesFrom string[]
    workingDir string

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:

    Endpoint string
    Endpoint string
    endpoint string
    endpoint String
    endpoint string
    endpoint String

    Supporting Types

    BuildConfig, BuildConfigArgs

    Context string
    Args Dictionary<string, string>
    CacheFrom List<string>
    CacheTo List<string>
    Dockerfile string
    Platforms List<string>
    ShmSize string
    Target string
    Context string
    Args map[string]string
    CacheFrom []string
    CacheTo []string
    Dockerfile string
    Platforms []string
    ShmSize string
    Target string
    context string
    args map(string)
    cache_from list(string)
    cache_to list(string)
    dockerfile string
    platforms list(string)
    shm_size string
    target string
    context String
    args Map<String,String>
    cacheFrom List<String>
    cacheTo List<String>
    dockerfile String
    platforms List<String>
    shmSize String
    target String
    context string
    args {[key: string]: string}
    cacheFrom string[]
    cacheTo string[]
    dockerfile string
    platforms string[]
    shmSize string
    target string
    context str
    args Mapping[str, str]
    cache_from Sequence[str]
    cache_to Sequence[str]
    dockerfile str
    platforms Sequence[str]
    shm_size str
    target str
    context String
    args Map<String>
    cacheFrom List<String>
    cacheTo List<String>
    dockerfile String
    platforms List<String>
    shmSize String
    target String

    DeployConfig, DeployConfigArgs

    HealthCheckConfig, HealthCheckConfigArgs

    intervalSeconds Integer
    retries Integer
    startPeriodSeconds Integer
    test List<String>
    timeoutSeconds Integer
    intervalSeconds Number
    retries Number
    startPeriodSeconds Number
    test List<String>
    timeoutSeconds Number

    PostgresConfig, PostgresConfigArgs

    RedisConfig, RedisConfigArgs

    ResourceConfig, ResourceConfigArgs

    Cpus double
    Memory string
    Cpus float64
    Memory string
    cpus number
    memory string
    cpus Double
    memory String
    cpus number
    memory string
    cpus float
    memory str
    cpus Number
    memory String

    Resources, ResourcesArgs

    ServiceConfig, ServiceConfigArgs

    Autoscaling bool
    Build DefangLabs.DefangGcp.Compose.Inputs.BuildConfig
    Command List<string>
    ContainerName string
    DependsOn Dictionary<string, DefangLabs.DefangGcp.Compose.Inputs.ServiceDependency>
    Deploy DefangLabs.DefangGcp.Compose.Inputs.DeployConfig
    DomainName string
    Entrypoint List<string>
    Environment Dictionary<string, string>
    HealthCheck DefangLabs.DefangGcp.Compose.Inputs.HealthCheckConfig
    Image string
    Llm DefangLabs.DefangGcp.Compose.Inputs.LlmConfig
    NetworkMode string
    Networks Dictionary<string, DefangLabs.DefangGcp.Compose.Inputs.ServiceNetworkConfig>
    Platform string
    Policies List<string>
    Ports List<DefangLabs.DefangGcp.Compose.Inputs.ServicePortConfig>
    Postgres DefangLabs.DefangGcp.Compose.Inputs.PostgresConfig
    Redis DefangLabs.DefangGcp.Compose.Inputs.RedisConfig
    Restart string
    StopGracePeriod string
    Volumes List<DefangLabs.DefangGcp.Compose.Inputs.ServiceVolumeConfig>
    VolumesFrom List<string>
    WorkingDir string

    ServiceDependency, ServiceDependencyArgs

    Condition string
    Required bool
    Condition string
    Required bool
    condition string
    required bool
    condition String
    required Boolean
    condition string
    required boolean
    condition String
    required Boolean

    ServiceNetworkConfig, ServiceNetworkConfigArgs

    Aliases List<string>
    Aliases []string
    aliases list(string)
    aliases List<String>
    aliases string[]
    aliases Sequence[str]
    aliases List<String>

    ServicePortConfig, ServicePortConfigArgs

    Target int
    AppProtocol string
    Listener string
    Mode string
    Protocol string
    Target int
    AppProtocol string
    Listener string
    Mode string
    Protocol string
    target number
    app_protocol string
    listener string
    mode string
    protocol string
    target Integer
    appProtocol String
    listener String
    mode String
    protocol String
    target number
    appProtocol string
    listener string
    mode string
    protocol string
    target Number
    appProtocol String
    listener String
    mode String
    protocol String

    ServiceVolumeConfig, ServiceVolumeConfigArgs

    Source string
    Target string
    ReadOnly bool
    Source string
    Target string
    ReadOnly bool
    source string
    target string
    read_only bool
    source String
    target String
    readOnly Boolean
    source string
    target string
    readOnly boolean
    source String
    target String
    readOnly Boolean

    Package Details

    Repository
    defang-gcp DefangLabs/pulumi-defang
    License
    Apache-2.0
    defang-gcp logo
    Viewing docs for Defang GCP v2.4.1
    published on Saturday, Jul 11, 2026 by Defang

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial