1. Packages
  2. Volcengine
  3. API Docs
  4. apig
  5. ApigUpstreamVersion
Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine

volcengine.apig.ApigUpstreamVersion

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine

    Provides a resource to manage apig upstream version

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.getZones({});
    const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
        vpcName: "acc-test-vpc",
        cidrBlock: "172.16.0.0/16",
    });
    const foo1 = new volcengine.vpc.Subnet("foo1", {
        subnetName: "acc-test-subnet",
        cidrBlock: "172.16.0.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        vpcId: fooVpc.id,
    });
    const foo2 = new volcengine.vpc.Subnet("foo2", {
        subnetName: "acc-test-subnet",
        cidrBlock: "172.16.1.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[1]?.id),
        vpcId: fooVpc.id,
    });
    const fooApigGateway = new volcengine.apig.ApigGateway("fooApigGateway", {
        type: "standard",
        comments: "acc-test",
        projectName: "default",
        tags: [{
            key: "k1",
            value: "v1",
        }],
        networkSpec: {
            vpcId: fooVpc.id,
            subnetIds: [
                foo1.id,
                foo2.id,
            ],
        },
        resourceSpec: {
            replicas: 2,
            instanceSpecCode: "1c2g",
            clbSpecCode: "small_1",
            publicNetworkBillingType: "bandwidth",
            publicNetworkBandwidth: 1,
            networkType: {
                enablePublicNetwork: true,
                enablePrivateNetwork: true,
            },
        },
        logSpec: {
            enable: true,
            projectId: "d3cb87c0-faeb-4074-b1ee-9bd747865a76",
            topicId: "d339482e-d86d-4bd8-a9bb-f270417f00a1",
        },
        monitorSpec: {
            enable: true,
            workspaceId: "4ed1caf3-279d-4c5f-8301-87ea38e92ffc",
        },
    });
    const fooApigGatewayService = new volcengine.apig.ApigGatewayService("fooApigGatewayService", {
        gatewayId: fooApigGateway.id,
        serviceName: "acc-test-apig-service",
        comments: "acc-test",
        protocols: [
            "HTTP",
            "HTTPS",
        ],
        authSpec: {
            enable: false,
        },
    });
    const foo_k8sApigUpstreamSource = new volcengine.apig.ApigUpstreamSource("foo-k8sApigUpstreamSource", {
        gatewayId: fooApigGateway.id,
        comments: "acc-test-k8s",
        sourceType: "K8S",
        sourceSpec: {
            k8sSource: {
                clusterId: "cd197sac4mpmnruh7um80",
            },
        },
        ingressSettings: [{
            enableIngress: true,
            updateStatus: true,
            ingressClasses: ["test"],
            watchNamespaces: ["default"],
        }],
    });
    const foo_k8sApigUpstream = new volcengine.apig.ApigUpstream("foo-k8sApigUpstream", {
        gatewayId: fooApigGateway.id,
        comments: "acc-test",
        resourceType: "Console",
        protocol: "HTTP",
        loadBalancerSettings: {
            lbPolicy: "ConsistentHashLB",
            consistentHashLb: {
                hashKey: "HTTPCookie",
                httpCookie: {
                    name: "test",
                    path: "/",
                    ttl: 300,
                },
            },
        },
        tlsSettings: {
            tlsMode: "SIMPLE",
            sni: "test",
        },
        circuitBreakingSettings: {
            enable: false,
            consecutiveErrors: 5,
            interval: 10000,
            baseEjectionTime: 30000,
            maxEjectionPercent: 20,
            minHealthPercent: 60,
        },
        sourceType: "K8S",
        upstreamSpec: {
            k8sService: {
                namespace: "default",
                name: "kubernetes",
                port: 443,
            },
        },
    }, {
        dependsOn: [foo_k8sApigUpstreamSource],
    });
    const fooApigUpstreamVersion = new volcengine.apig.ApigUpstreamVersion("fooApigUpstreamVersion", {
        upstreamId: foo_k8sApigUpstream.id,
        upstreamVersion: {
            name: "acc-test-version",
            labels: [{
                key: "k1",
                value: "v2",
            }],
        },
    });
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.get_zones()
    foo_vpc = volcengine.vpc.Vpc("fooVpc",
        vpc_name="acc-test-vpc",
        cidr_block="172.16.0.0/16")
    foo1 = volcengine.vpc.Subnet("foo1",
        subnet_name="acc-test-subnet",
        cidr_block="172.16.0.0/24",
        zone_id=foo_zones.zones[0].id,
        vpc_id=foo_vpc.id)
    foo2 = volcengine.vpc.Subnet("foo2",
        subnet_name="acc-test-subnet",
        cidr_block="172.16.1.0/24",
        zone_id=foo_zones.zones[1].id,
        vpc_id=foo_vpc.id)
    foo_apig_gateway = volcengine.apig.ApigGateway("fooApigGateway",
        type="standard",
        comments="acc-test",
        project_name="default",
        tags=[volcengine.apig.ApigGatewayTagArgs(
            key="k1",
            value="v1",
        )],
        network_spec=volcengine.apig.ApigGatewayNetworkSpecArgs(
            vpc_id=foo_vpc.id,
            subnet_ids=[
                foo1.id,
                foo2.id,
            ],
        ),
        resource_spec=volcengine.apig.ApigGatewayResourceSpecArgs(
            replicas=2,
            instance_spec_code="1c2g",
            clb_spec_code="small_1",
            public_network_billing_type="bandwidth",
            public_network_bandwidth=1,
            network_type=volcengine.apig.ApigGatewayResourceSpecNetworkTypeArgs(
                enable_public_network=True,
                enable_private_network=True,
            ),
        ),
        log_spec=volcengine.apig.ApigGatewayLogSpecArgs(
            enable=True,
            project_id="d3cb87c0-faeb-4074-b1ee-9bd747865a76",
            topic_id="d339482e-d86d-4bd8-a9bb-f270417f00a1",
        ),
        monitor_spec=volcengine.apig.ApigGatewayMonitorSpecArgs(
            enable=True,
            workspace_id="4ed1caf3-279d-4c5f-8301-87ea38e92ffc",
        ))
    foo_apig_gateway_service = volcengine.apig.ApigGatewayService("fooApigGatewayService",
        gateway_id=foo_apig_gateway.id,
        service_name="acc-test-apig-service",
        comments="acc-test",
        protocols=[
            "HTTP",
            "HTTPS",
        ],
        auth_spec=volcengine.apig.ApigGatewayServiceAuthSpecArgs(
            enable=False,
        ))
    foo_k8s_apig_upstream_source = volcengine.apig.ApigUpstreamSource("foo-k8sApigUpstreamSource",
        gateway_id=foo_apig_gateway.id,
        comments="acc-test-k8s",
        source_type="K8S",
        source_spec=volcengine.apig.ApigUpstreamSourceSourceSpecArgs(
            k8s_source=volcengine.apig.ApigUpstreamSourceSourceSpecK8sSourceArgs(
                cluster_id="cd197sac4mpmnruh7um80",
            ),
        ),
        ingress_settings=[volcengine.apig.ApigUpstreamSourceIngressSettingArgs(
            enable_ingress=True,
            update_status=True,
            ingress_classes=["test"],
            watch_namespaces=["default"],
        )])
    foo_k8s_apig_upstream = volcengine.apig.ApigUpstream("foo-k8sApigUpstream",
        gateway_id=foo_apig_gateway.id,
        comments="acc-test",
        resource_type="Console",
        protocol="HTTP",
        load_balancer_settings=volcengine.apig.ApigUpstreamLoadBalancerSettingsArgs(
            lb_policy="ConsistentHashLB",
            consistent_hash_lb=volcengine.apig.ApigUpstreamLoadBalancerSettingsConsistentHashLbArgs(
                hash_key="HTTPCookie",
                http_cookie=volcengine.apig.ApigUpstreamLoadBalancerSettingsConsistentHashLbHttpCookieArgs(
                    name="test",
                    path="/",
                    ttl=300,
                ),
            ),
        ),
        tls_settings=volcengine.apig.ApigUpstreamTlsSettingsArgs(
            tls_mode="SIMPLE",
            sni="test",
        ),
        circuit_breaking_settings=volcengine.apig.ApigUpstreamCircuitBreakingSettingsArgs(
            enable=False,
            consecutive_errors=5,
            interval=10000,
            base_ejection_time=30000,
            max_ejection_percent=20,
            min_health_percent=60,
        ),
        source_type="K8S",
        upstream_spec=volcengine.apig.ApigUpstreamUpstreamSpecArgs(
            k8s_service=volcengine.apig.ApigUpstreamUpstreamSpecK8sServiceArgs(
                namespace="default",
                name="kubernetes",
                port=443,
            ),
        ),
        opts=pulumi.ResourceOptions(depends_on=[foo_k8s_apig_upstream_source]))
    foo_apig_upstream_version = volcengine.apig.ApigUpstreamVersion("fooApigUpstreamVersion",
        upstream_id=foo_k8s_apig_upstream.id,
        upstream_version=volcengine.apig.ApigUpstreamVersionUpstreamVersionArgs(
            name="acc-test-version",
            labels=[volcengine.apig.ApigUpstreamVersionUpstreamVersionLabelArgs(
                key="k1",
                value="v2",
            )],
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/apig"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
    			VpcName:   pulumi.String("acc-test-vpc"),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		foo1, err := vpc.NewSubnet(ctx, "foo1", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-test-subnet"),
    			CidrBlock:  pulumi.String("172.16.0.0/24"),
    			ZoneId:     pulumi.String(fooZones.Zones[0].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		foo2, err := vpc.NewSubnet(ctx, "foo2", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-test-subnet"),
    			CidrBlock:  pulumi.String("172.16.1.0/24"),
    			ZoneId:     pulumi.String(fooZones.Zones[1].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		fooApigGateway, err := apig.NewApigGateway(ctx, "fooApigGateway", &apig.ApigGatewayArgs{
    			Type:        pulumi.String("standard"),
    			Comments:    pulumi.String("acc-test"),
    			ProjectName: pulumi.String("default"),
    			Tags: apig.ApigGatewayTagArray{
    				&apig.ApigGatewayTagArgs{
    					Key:   pulumi.String("k1"),
    					Value: pulumi.String("v1"),
    				},
    			},
    			NetworkSpec: &apig.ApigGatewayNetworkSpecArgs{
    				VpcId: fooVpc.ID(),
    				SubnetIds: pulumi.StringArray{
    					foo1.ID(),
    					foo2.ID(),
    				},
    			},
    			ResourceSpec: &apig.ApigGatewayResourceSpecArgs{
    				Replicas:                 pulumi.Int(2),
    				InstanceSpecCode:         pulumi.String("1c2g"),
    				ClbSpecCode:              pulumi.String("small_1"),
    				PublicNetworkBillingType: pulumi.String("bandwidth"),
    				PublicNetworkBandwidth:   pulumi.Int(1),
    				NetworkType: &apig.ApigGatewayResourceSpecNetworkTypeArgs{
    					EnablePublicNetwork:  pulumi.Bool(true),
    					EnablePrivateNetwork: pulumi.Bool(true),
    				},
    			},
    			LogSpec: &apig.ApigGatewayLogSpecArgs{
    				Enable:    pulumi.Bool(true),
    				ProjectId: pulumi.String("d3cb87c0-faeb-4074-b1ee-9bd747865a76"),
    				TopicId:   pulumi.String("d339482e-d86d-4bd8-a9bb-f270417f00a1"),
    			},
    			MonitorSpec: &apig.ApigGatewayMonitorSpecArgs{
    				Enable:      pulumi.Bool(true),
    				WorkspaceId: pulumi.String("4ed1caf3-279d-4c5f-8301-87ea38e92ffc"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apig.NewApigGatewayService(ctx, "fooApigGatewayService", &apig.ApigGatewayServiceArgs{
    			GatewayId:   fooApigGateway.ID(),
    			ServiceName: pulumi.String("acc-test-apig-service"),
    			Comments:    pulumi.String("acc-test"),
    			Protocols: pulumi.StringArray{
    				pulumi.String("HTTP"),
    				pulumi.String("HTTPS"),
    			},
    			AuthSpec: &apig.ApigGatewayServiceAuthSpecArgs{
    				Enable: pulumi.Bool(false),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apig.NewApigUpstreamSource(ctx, "foo-k8sApigUpstreamSource", &apig.ApigUpstreamSourceArgs{
    			GatewayId:  fooApigGateway.ID(),
    			Comments:   pulumi.String("acc-test-k8s"),
    			SourceType: pulumi.String("K8S"),
    			SourceSpec: &apig.ApigUpstreamSourceSourceSpecArgs{
    				K8sSource: &apig.ApigUpstreamSourceSourceSpecK8sSourceArgs{
    					ClusterId: pulumi.String("cd197sac4mpmnruh7um80"),
    				},
    			},
    			IngressSettings: apig.ApigUpstreamSourceIngressSettingArray{
    				&apig.ApigUpstreamSourceIngressSettingArgs{
    					EnableIngress: pulumi.Bool(true),
    					UpdateStatus:  pulumi.Bool(true),
    					IngressClasses: pulumi.StringArray{
    						pulumi.String("test"),
    					},
    					WatchNamespaces: pulumi.StringArray{
    						pulumi.String("default"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apig.NewApigUpstream(ctx, "foo-k8sApigUpstream", &apig.ApigUpstreamArgs{
    			GatewayId:    fooApigGateway.ID(),
    			Comments:     pulumi.String("acc-test"),
    			ResourceType: pulumi.String("Console"),
    			Protocol:     pulumi.String("HTTP"),
    			LoadBalancerSettings: &apig.ApigUpstreamLoadBalancerSettingsArgs{
    				LbPolicy: pulumi.String("ConsistentHashLB"),
    				ConsistentHashLb: &apig.ApigUpstreamLoadBalancerSettingsConsistentHashLbArgs{
    					HashKey: pulumi.String("HTTPCookie"),
    					HttpCookie: &apig.ApigUpstreamLoadBalancerSettingsConsistentHashLbHttpCookieArgs{
    						Name: pulumi.String("test"),
    						Path: pulumi.String("/"),
    						Ttl:  pulumi.Int(300),
    					},
    				},
    			},
    			TlsSettings: &apig.ApigUpstreamTlsSettingsArgs{
    				TlsMode: pulumi.String("SIMPLE"),
    				Sni:     pulumi.String("test"),
    			},
    			CircuitBreakingSettings: &apig.ApigUpstreamCircuitBreakingSettingsArgs{
    				Enable:             pulumi.Bool(false),
    				ConsecutiveErrors:  pulumi.Int(5),
    				Interval:           pulumi.Int(10000),
    				BaseEjectionTime:   pulumi.Int(30000),
    				MaxEjectionPercent: pulumi.Int(20),
    				MinHealthPercent:   pulumi.Int(60),
    			},
    			SourceType: pulumi.String("K8S"),
    			UpstreamSpec: &apig.ApigUpstreamUpstreamSpecArgs{
    				K8sService: &apig.ApigUpstreamUpstreamSpecK8sServiceArgs{
    					Namespace: pulumi.String("default"),
    					Name:      pulumi.String("kubernetes"),
    					Port:      pulumi.Int(443),
    				},
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			foo_k8sApigUpstreamSource,
    		}))
    		if err != nil {
    			return err
    		}
    		_, err = apig.NewApigUpstreamVersion(ctx, "fooApigUpstreamVersion", &apig.ApigUpstreamVersionArgs{
    			UpstreamId: foo_k8sApigUpstream.ID(),
    			UpstreamVersion: &apig.ApigUpstreamVersionUpstreamVersionArgs{
    				Name: pulumi.String("acc-test-version"),
    				Labels: apig.ApigUpstreamVersionUpstreamVersionLabelArray{
    					&apig.ApigUpstreamVersionUpstreamVersionLabelArgs{
    						Key:   pulumi.String("k1"),
    						Value: pulumi.String("v2"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooZones = Volcengine.Ecs.GetZones.Invoke();
    
        var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
        {
            VpcName = "acc-test-vpc",
            CidrBlock = "172.16.0.0/16",
        });
    
        var foo1 = new Volcengine.Vpc.Subnet("foo1", new()
        {
            SubnetName = "acc-test-subnet",
            CidrBlock = "172.16.0.0/24",
            ZoneId = fooZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            VpcId = fooVpc.Id,
        });
    
        var foo2 = new Volcengine.Vpc.Subnet("foo2", new()
        {
            SubnetName = "acc-test-subnet",
            CidrBlock = "172.16.1.0/24",
            ZoneId = fooZones.Apply(getZonesResult => getZonesResult.Zones[1]?.Id),
            VpcId = fooVpc.Id,
        });
    
        var fooApigGateway = new Volcengine.Apig.ApigGateway("fooApigGateway", new()
        {
            Type = "standard",
            Comments = "acc-test",
            ProjectName = "default",
            Tags = new[]
            {
                new Volcengine.Apig.Inputs.ApigGatewayTagArgs
                {
                    Key = "k1",
                    Value = "v1",
                },
            },
            NetworkSpec = new Volcengine.Apig.Inputs.ApigGatewayNetworkSpecArgs
            {
                VpcId = fooVpc.Id,
                SubnetIds = new[]
                {
                    foo1.Id,
                    foo2.Id,
                },
            },
            ResourceSpec = new Volcengine.Apig.Inputs.ApigGatewayResourceSpecArgs
            {
                Replicas = 2,
                InstanceSpecCode = "1c2g",
                ClbSpecCode = "small_1",
                PublicNetworkBillingType = "bandwidth",
                PublicNetworkBandwidth = 1,
                NetworkType = new Volcengine.Apig.Inputs.ApigGatewayResourceSpecNetworkTypeArgs
                {
                    EnablePublicNetwork = true,
                    EnablePrivateNetwork = true,
                },
            },
            LogSpec = new Volcengine.Apig.Inputs.ApigGatewayLogSpecArgs
            {
                Enable = true,
                ProjectId = "d3cb87c0-faeb-4074-b1ee-9bd747865a76",
                TopicId = "d339482e-d86d-4bd8-a9bb-f270417f00a1",
            },
            MonitorSpec = new Volcengine.Apig.Inputs.ApigGatewayMonitorSpecArgs
            {
                Enable = true,
                WorkspaceId = "4ed1caf3-279d-4c5f-8301-87ea38e92ffc",
            },
        });
    
        var fooApigGatewayService = new Volcengine.Apig.ApigGatewayService("fooApigGatewayService", new()
        {
            GatewayId = fooApigGateway.Id,
            ServiceName = "acc-test-apig-service",
            Comments = "acc-test",
            Protocols = new[]
            {
                "HTTP",
                "HTTPS",
            },
            AuthSpec = new Volcengine.Apig.Inputs.ApigGatewayServiceAuthSpecArgs
            {
                Enable = false,
            },
        });
    
        var foo_k8sApigUpstreamSource = new Volcengine.Apig.ApigUpstreamSource("foo-k8sApigUpstreamSource", new()
        {
            GatewayId = fooApigGateway.Id,
            Comments = "acc-test-k8s",
            SourceType = "K8S",
            SourceSpec = new Volcengine.Apig.Inputs.ApigUpstreamSourceSourceSpecArgs
            {
                K8sSource = new Volcengine.Apig.Inputs.ApigUpstreamSourceSourceSpecK8sSourceArgs
                {
                    ClusterId = "cd197sac4mpmnruh7um80",
                },
            },
            IngressSettings = new[]
            {
                new Volcengine.Apig.Inputs.ApigUpstreamSourceIngressSettingArgs
                {
                    EnableIngress = true,
                    UpdateStatus = true,
                    IngressClasses = new[]
                    {
                        "test",
                    },
                    WatchNamespaces = new[]
                    {
                        "default",
                    },
                },
            },
        });
    
        var foo_k8sApigUpstream = new Volcengine.Apig.ApigUpstream("foo-k8sApigUpstream", new()
        {
            GatewayId = fooApigGateway.Id,
            Comments = "acc-test",
            ResourceType = "Console",
            Protocol = "HTTP",
            LoadBalancerSettings = new Volcengine.Apig.Inputs.ApigUpstreamLoadBalancerSettingsArgs
            {
                LbPolicy = "ConsistentHashLB",
                ConsistentHashLb = new Volcengine.Apig.Inputs.ApigUpstreamLoadBalancerSettingsConsistentHashLbArgs
                {
                    HashKey = "HTTPCookie",
                    HttpCookie = new Volcengine.Apig.Inputs.ApigUpstreamLoadBalancerSettingsConsistentHashLbHttpCookieArgs
                    {
                        Name = "test",
                        Path = "/",
                        Ttl = 300,
                    },
                },
            },
            TlsSettings = new Volcengine.Apig.Inputs.ApigUpstreamTlsSettingsArgs
            {
                TlsMode = "SIMPLE",
                Sni = "test",
            },
            CircuitBreakingSettings = new Volcengine.Apig.Inputs.ApigUpstreamCircuitBreakingSettingsArgs
            {
                Enable = false,
                ConsecutiveErrors = 5,
                Interval = 10000,
                BaseEjectionTime = 30000,
                MaxEjectionPercent = 20,
                MinHealthPercent = 60,
            },
            SourceType = "K8S",
            UpstreamSpec = new Volcengine.Apig.Inputs.ApigUpstreamUpstreamSpecArgs
            {
                K8sService = new Volcengine.Apig.Inputs.ApigUpstreamUpstreamSpecK8sServiceArgs
                {
                    Namespace = "default",
                    Name = "kubernetes",
                    Port = 443,
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                foo_k8sApigUpstreamSource,
            },
        });
    
        var fooApigUpstreamVersion = new Volcengine.Apig.ApigUpstreamVersion("fooApigUpstreamVersion", new()
        {
            UpstreamId = foo_k8sApigUpstream.Id,
            UpstreamVersion = new Volcengine.Apig.Inputs.ApigUpstreamVersionUpstreamVersionArgs
            {
                Name = "acc-test-version",
                Labels = new[]
                {
                    new Volcengine.Apig.Inputs.ApigUpstreamVersionUpstreamVersionLabelArgs
                    {
                        Key = "k1",
                        Value = "v2",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.GetZonesArgs;
    import com.pulumi.volcengine.vpc.Vpc;
    import com.pulumi.volcengine.vpc.VpcArgs;
    import com.pulumi.volcengine.vpc.Subnet;
    import com.pulumi.volcengine.vpc.SubnetArgs;
    import com.pulumi.volcengine.apig.ApigGateway;
    import com.pulumi.volcengine.apig.ApigGatewayArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayTagArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayNetworkSpecArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayResourceSpecArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayResourceSpecNetworkTypeArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayLogSpecArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayMonitorSpecArgs;
    import com.pulumi.volcengine.apig.ApigGatewayService;
    import com.pulumi.volcengine.apig.ApigGatewayServiceArgs;
    import com.pulumi.volcengine.apig.inputs.ApigGatewayServiceAuthSpecArgs;
    import com.pulumi.volcengine.apig.ApigUpstreamSource;
    import com.pulumi.volcengine.apig.ApigUpstreamSourceArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamSourceSourceSpecArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamSourceSourceSpecK8sSourceArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamSourceIngressSettingArgs;
    import com.pulumi.volcengine.apig.ApigUpstream;
    import com.pulumi.volcengine.apig.ApigUpstreamArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamLoadBalancerSettingsArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamLoadBalancerSettingsConsistentHashLbArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamLoadBalancerSettingsConsistentHashLbHttpCookieArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamTlsSettingsArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamCircuitBreakingSettingsArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamUpstreamSpecArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamUpstreamSpecK8sServiceArgs;
    import com.pulumi.volcengine.apig.ApigUpstreamVersion;
    import com.pulumi.volcengine.apig.ApigUpstreamVersionArgs;
    import com.pulumi.volcengine.apig.inputs.ApigUpstreamVersionUpstreamVersionArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var fooZones = EcsFunctions.getZones();
    
            var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
                .vpcName("acc-test-vpc")
                .cidrBlock("172.16.0.0/16")
                .build());
    
            var foo1 = new Subnet("foo1", SubnetArgs.builder()        
                .subnetName("acc-test-subnet")
                .cidrBlock("172.16.0.0/24")
                .zoneId(fooZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .vpcId(fooVpc.id())
                .build());
    
            var foo2 = new Subnet("foo2", SubnetArgs.builder()        
                .subnetName("acc-test-subnet")
                .cidrBlock("172.16.1.0/24")
                .zoneId(fooZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
                .vpcId(fooVpc.id())
                .build());
    
            var fooApigGateway = new ApigGateway("fooApigGateway", ApigGatewayArgs.builder()        
                .type("standard")
                .comments("acc-test")
                .projectName("default")
                .tags(ApigGatewayTagArgs.builder()
                    .key("k1")
                    .value("v1")
                    .build())
                .networkSpec(ApigGatewayNetworkSpecArgs.builder()
                    .vpcId(fooVpc.id())
                    .subnetIds(                
                        foo1.id(),
                        foo2.id())
                    .build())
                .resourceSpec(ApigGatewayResourceSpecArgs.builder()
                    .replicas(2)
                    .instanceSpecCode("1c2g")
                    .clbSpecCode("small_1")
                    .publicNetworkBillingType("bandwidth")
                    .publicNetworkBandwidth(1)
                    .networkType(ApigGatewayResourceSpecNetworkTypeArgs.builder()
                        .enablePublicNetwork(true)
                        .enablePrivateNetwork(true)
                        .build())
                    .build())
                .logSpec(ApigGatewayLogSpecArgs.builder()
                    .enable(true)
                    .projectId("d3cb87c0-faeb-4074-b1ee-9bd747865a76")
                    .topicId("d339482e-d86d-4bd8-a9bb-f270417f00a1")
                    .build())
                .monitorSpec(ApigGatewayMonitorSpecArgs.builder()
                    .enable(true)
                    .workspaceId("4ed1caf3-279d-4c5f-8301-87ea38e92ffc")
                    .build())
                .build());
    
            var fooApigGatewayService = new ApigGatewayService("fooApigGatewayService", ApigGatewayServiceArgs.builder()        
                .gatewayId(fooApigGateway.id())
                .serviceName("acc-test-apig-service")
                .comments("acc-test")
                .protocols(            
                    "HTTP",
                    "HTTPS")
                .authSpec(ApigGatewayServiceAuthSpecArgs.builder()
                    .enable(false)
                    .build())
                .build());
    
            var foo_k8sApigUpstreamSource = new ApigUpstreamSource("foo-k8sApigUpstreamSource", ApigUpstreamSourceArgs.builder()        
                .gatewayId(fooApigGateway.id())
                .comments("acc-test-k8s")
                .sourceType("K8S")
                .sourceSpec(ApigUpstreamSourceSourceSpecArgs.builder()
                    .k8sSource(ApigUpstreamSourceSourceSpecK8sSourceArgs.builder()
                        .clusterId("cd197sac4mpmnruh7um80")
                        .build())
                    .build())
                .ingressSettings(ApigUpstreamSourceIngressSettingArgs.builder()
                    .enableIngress(true)
                    .updateStatus(true)
                    .ingressClasses("test")
                    .watchNamespaces("default")
                    .build())
                .build());
    
            var foo_k8sApigUpstream = new ApigUpstream("foo-k8sApigUpstream", ApigUpstreamArgs.builder()        
                .gatewayId(fooApigGateway.id())
                .comments("acc-test")
                .resourceType("Console")
                .protocol("HTTP")
                .loadBalancerSettings(ApigUpstreamLoadBalancerSettingsArgs.builder()
                    .lbPolicy("ConsistentHashLB")
                    .consistentHashLb(ApigUpstreamLoadBalancerSettingsConsistentHashLbArgs.builder()
                        .hashKey("HTTPCookie")
                        .httpCookie(ApigUpstreamLoadBalancerSettingsConsistentHashLbHttpCookieArgs.builder()
                            .name("test")
                            .path("/")
                            .ttl(300)
                            .build())
                        .build())
                    .build())
                .tlsSettings(ApigUpstreamTlsSettingsArgs.builder()
                    .tlsMode("SIMPLE")
                    .sni("test")
                    .build())
                .circuitBreakingSettings(ApigUpstreamCircuitBreakingSettingsArgs.builder()
                    .enable(false)
                    .consecutiveErrors(5)
                    .interval(10000)
                    .baseEjectionTime(30000)
                    .maxEjectionPercent(20)
                    .minHealthPercent(60)
                    .build())
                .sourceType("K8S")
                .upstreamSpec(ApigUpstreamUpstreamSpecArgs.builder()
                    .k8sService(ApigUpstreamUpstreamSpecK8sServiceArgs.builder()
                        .namespace("default")
                        .name("kubernetes")
                        .port(443)
                        .build())
                    .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(foo_k8sApigUpstreamSource)
                    .build());
    
            var fooApigUpstreamVersion = new ApigUpstreamVersion("fooApigUpstreamVersion", ApigUpstreamVersionArgs.builder()        
                .upstreamId(foo_k8sApigUpstream.id())
                .upstreamVersion(ApigUpstreamVersionUpstreamVersionArgs.builder()
                    .name("acc-test-version")
                    .labels(ApigUpstreamVersionUpstreamVersionLabelArgs.builder()
                        .key("k1")
                        .value("v2")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      fooVpc:
        type: volcengine:vpc:Vpc
        properties:
          vpcName: acc-test-vpc
          cidrBlock: 172.16.0.0/16
      foo1:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-test-subnet
          cidrBlock: 172.16.0.0/24
          zoneId: ${fooZones.zones[0].id}
          vpcId: ${fooVpc.id}
      foo2:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-test-subnet
          cidrBlock: 172.16.1.0/24
          zoneId: ${fooZones.zones[1].id}
          vpcId: ${fooVpc.id}
      fooApigGateway:
        type: volcengine:apig:ApigGateway
        properties:
          type: standard
          comments: acc-test
          projectName: default
          tags:
            - key: k1
              value: v1
          networkSpec:
            vpcId: ${fooVpc.id}
            subnetIds:
              - ${foo1.id}
              - ${foo2.id}
          resourceSpec:
            replicas: 2
            instanceSpecCode: 1c2g
            clbSpecCode: small_1
            publicNetworkBillingType: bandwidth
            publicNetworkBandwidth: 1
            networkType:
              enablePublicNetwork: true
              enablePrivateNetwork: true
          logSpec:
            enable: true
            projectId: d3cb87c0-faeb-4074-b1ee-9bd747865a76
            topicId: d339482e-d86d-4bd8-a9bb-f270417f00a1
          monitorSpec:
            enable: true
            workspaceId: 4ed1caf3-279d-4c5f-8301-87ea38e92ffc
      fooApigGatewayService:
        type: volcengine:apig:ApigGatewayService
        properties:
          gatewayId: ${fooApigGateway.id}
          serviceName: acc-test-apig-service
          comments: acc-test
          protocols:
            - HTTP
            - HTTPS
          authSpec:
            enable: false
      foo-k8sApigUpstreamSource:
        type: volcengine:apig:ApigUpstreamSource
        properties:
          gatewayId: ${fooApigGateway.id}
          comments: acc-test-k8s
          sourceType: K8S
          sourceSpec:
            k8sSource:
              clusterId: cd197sac4mpmnruh7um80
          ingressSettings:
            - enableIngress: true
              updateStatus: true
              ingressClasses:
                - test
              watchNamespaces:
                - default
      foo-k8sApigUpstream:
        type: volcengine:apig:ApigUpstream
        properties:
          gatewayId: ${fooApigGateway.id}
          comments: acc-test
          resourceType: Console
          protocol: HTTP
          loadBalancerSettings:
            lbPolicy: ConsistentHashLB
            consistentHashLb:
              hashKey: HTTPCookie
              httpCookie:
                name: test
                path: /
                ttl: 300
          tlsSettings:
            tlsMode: SIMPLE
            sni: test
          circuitBreakingSettings:
            enable: false
            consecutiveErrors: 5
            interval: 10000
            baseEjectionTime: 30000
            maxEjectionPercent: 20
            minHealthPercent: 60
          sourceType: K8S
          upstreamSpec:
            k8sService:
              namespace: default
              name: kubernetes
              port: 443
        options:
          dependson:
            - ${["foo-k8sApigUpstreamSource"]}
      fooApigUpstreamVersion:
        type: volcengine:apig:ApigUpstreamVersion
        properties:
          upstreamId: ${["foo-k8sApigUpstream"].id}
          upstreamVersion:
            name: acc-test-version
            labels:
              - key: k1
                value: v2
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:getZones
          Arguments: {}
    

    Create ApigUpstreamVersion Resource

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

    Constructor syntax

    new ApigUpstreamVersion(name: string, args: ApigUpstreamVersionArgs, opts?: CustomResourceOptions);
    @overload
    def ApigUpstreamVersion(resource_name: str,
                            args: ApigUpstreamVersionArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApigUpstreamVersion(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            upstream_id: Optional[str] = None,
                            upstream_version: Optional[ApigUpstreamVersionUpstreamVersionArgs] = None)
    func NewApigUpstreamVersion(ctx *Context, name string, args ApigUpstreamVersionArgs, opts ...ResourceOption) (*ApigUpstreamVersion, error)
    public ApigUpstreamVersion(string name, ApigUpstreamVersionArgs args, CustomResourceOptions? opts = null)
    public ApigUpstreamVersion(String name, ApigUpstreamVersionArgs args)
    public ApigUpstreamVersion(String name, ApigUpstreamVersionArgs args, CustomResourceOptions options)
    
    type: volcengine:apig:ApigUpstreamVersion
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ApigUpstreamVersionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ApigUpstreamVersionArgs
    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 ApigUpstreamVersionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApigUpstreamVersionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApigUpstreamVersionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var apigUpstreamVersionResource = new Volcengine.Apig.ApigUpstreamVersion("apigUpstreamVersionResource", new()
    {
        UpstreamId = "string",
        UpstreamVersion = new Volcengine.Apig.Inputs.ApigUpstreamVersionUpstreamVersionArgs
        {
            Name = "string",
            Labels = new[]
            {
                new Volcengine.Apig.Inputs.ApigUpstreamVersionUpstreamVersionLabelArgs
                {
                    Key = "string",
                    Value = "string",
                },
            },
            UpdateTime = "string",
        },
    });
    
    example, err := apig.NewApigUpstreamVersion(ctx, "apigUpstreamVersionResource", &apig.ApigUpstreamVersionArgs{
    	UpstreamId: pulumi.String("string"),
    	UpstreamVersion: &apig.ApigUpstreamVersionUpstreamVersionArgs{
    		Name: pulumi.String("string"),
    		Labels: apig.ApigUpstreamVersionUpstreamVersionLabelArray{
    			&apig.ApigUpstreamVersionUpstreamVersionLabelArgs{
    				Key:   pulumi.String("string"),
    				Value: pulumi.String("string"),
    			},
    		},
    		UpdateTime: pulumi.String("string"),
    	},
    })
    
    var apigUpstreamVersionResource = new ApigUpstreamVersion("apigUpstreamVersionResource", ApigUpstreamVersionArgs.builder()
        .upstreamId("string")
        .upstreamVersion(ApigUpstreamVersionUpstreamVersionArgs.builder()
            .name("string")
            .labels(ApigUpstreamVersionUpstreamVersionLabelArgs.builder()
                .key("string")
                .value("string")
                .build())
            .updateTime("string")
            .build())
        .build());
    
    apig_upstream_version_resource = volcengine.apig.ApigUpstreamVersion("apigUpstreamVersionResource",
        upstream_id="string",
        upstream_version={
            "name": "string",
            "labels": [{
                "key": "string",
                "value": "string",
            }],
            "update_time": "string",
        })
    
    const apigUpstreamVersionResource = new volcengine.apig.ApigUpstreamVersion("apigUpstreamVersionResource", {
        upstreamId: "string",
        upstreamVersion: {
            name: "string",
            labels: [{
                key: "string",
                value: "string",
            }],
            updateTime: "string",
        },
    });
    
    type: volcengine:apig:ApigUpstreamVersion
    properties:
        upstreamId: string
        upstreamVersion:
            labels:
                - key: string
                  value: string
            name: string
            updateTime: string
    

    ApigUpstreamVersion 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 ApigUpstreamVersion resource accepts the following input properties:

    UpstreamId string
    The id of the apig upstream.
    UpstreamVersion ApigUpstreamVersionUpstreamVersion
    The version of the apig upstream.
    UpstreamId string
    The id of the apig upstream.
    UpstreamVersion ApigUpstreamVersionUpstreamVersionArgs
    The version of the apig upstream.
    upstreamId String
    The id of the apig upstream.
    upstreamVersion ApigUpstreamVersionUpstreamVersion
    The version of the apig upstream.
    upstreamId string
    The id of the apig upstream.
    upstreamVersion ApigUpstreamVersionUpstreamVersion
    The version of the apig upstream.
    upstream_id str
    The id of the apig upstream.
    upstream_version ApigUpstreamVersionUpstreamVersionArgs
    The version of the apig upstream.
    upstreamId String
    The id of the apig upstream.
    upstreamVersion Property Map
    The version of the apig upstream.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ApigUpstreamVersion Resource

    Get an existing ApigUpstreamVersion resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ApigUpstreamVersionState, opts?: CustomResourceOptions): ApigUpstreamVersion
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            upstream_id: Optional[str] = None,
            upstream_version: Optional[ApigUpstreamVersionUpstreamVersionArgs] = None) -> ApigUpstreamVersion
    func GetApigUpstreamVersion(ctx *Context, name string, id IDInput, state *ApigUpstreamVersionState, opts ...ResourceOption) (*ApigUpstreamVersion, error)
    public static ApigUpstreamVersion Get(string name, Input<string> id, ApigUpstreamVersionState? state, CustomResourceOptions? opts = null)
    public static ApigUpstreamVersion get(String name, Output<String> id, ApigUpstreamVersionState state, CustomResourceOptions options)
    resources:  _:    type: volcengine:apig:ApigUpstreamVersion    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    UpstreamId string
    The id of the apig upstream.
    UpstreamVersion ApigUpstreamVersionUpstreamVersion
    The version of the apig upstream.
    UpstreamId string
    The id of the apig upstream.
    UpstreamVersion ApigUpstreamVersionUpstreamVersionArgs
    The version of the apig upstream.
    upstreamId String
    The id of the apig upstream.
    upstreamVersion ApigUpstreamVersionUpstreamVersion
    The version of the apig upstream.
    upstreamId string
    The id of the apig upstream.
    upstreamVersion ApigUpstreamVersionUpstreamVersion
    The version of the apig upstream.
    upstream_id str
    The id of the apig upstream.
    upstream_version ApigUpstreamVersionUpstreamVersionArgs
    The version of the apig upstream.
    upstreamId String
    The id of the apig upstream.
    upstreamVersion Property Map
    The version of the apig upstream.

    Supporting Types

    ApigUpstreamVersionUpstreamVersion, ApigUpstreamVersionUpstreamVersionArgs

    Name string
    The name of apig upstream version.
    Labels List<ApigUpstreamVersionUpstreamVersionLabel>
    The labels of apig upstream version.
    UpdateTime string
    The update time of apig upstream version.
    Name string
    The name of apig upstream version.
    Labels []ApigUpstreamVersionUpstreamVersionLabel
    The labels of apig upstream version.
    UpdateTime string
    The update time of apig upstream version.
    name String
    The name of apig upstream version.
    labels List<ApigUpstreamVersionUpstreamVersionLabel>
    The labels of apig upstream version.
    updateTime String
    The update time of apig upstream version.
    name string
    The name of apig upstream version.
    labels ApigUpstreamVersionUpstreamVersionLabel[]
    The labels of apig upstream version.
    updateTime string
    The update time of apig upstream version.
    name str
    The name of apig upstream version.
    labels Sequence[ApigUpstreamVersionUpstreamVersionLabel]
    The labels of apig upstream version.
    update_time str
    The update time of apig upstream version.
    name String
    The name of apig upstream version.
    labels List<Property Map>
    The labels of apig upstream version.
    updateTime String
    The update time of apig upstream version.

    ApigUpstreamVersionUpstreamVersionLabel, ApigUpstreamVersionUpstreamVersionLabelArgs

    Key string
    The key of apig upstream version label.
    Value string
    The value of apig upstream version label.
    Key string
    The key of apig upstream version label.
    Value string
    The value of apig upstream version label.
    key String
    The key of apig upstream version label.
    value String
    The value of apig upstream version label.
    key string
    The key of apig upstream version label.
    value string
    The value of apig upstream version label.
    key str
    The key of apig upstream version label.
    value str
    The value of apig upstream version label.
    key String
    The key of apig upstream version label.
    value String
    The value of apig upstream version label.

    Import

    ApigUpstreamVersion can be imported using the id, e.g.

    $ pulumi import volcengine:apig/apigUpstreamVersion:ApigUpstreamVersion default resource_id
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine