1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. apigateway
  5. LogConfig
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.apigateway.LogConfig

Explore with Pulumi AI

Provides a Api Gateway Log Config resource.

For information about Api Gateway Log Config and how to use it, see What is Log Config.

NOTE: Available since v1.185.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";

const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new random.index.Integer("default", {
    max: 99999,
    min: 10000,
});
const example = new alicloud.log.Project("example", {
    projectName: `${name}-${_default.result}`,
    description: name,
});
const exampleStore = new alicloud.log.Store("example", {
    projectName: example.projectName,
    logstoreName: `${name}-${_default.result}`,
    shardCount: 3,
    autoSplit: true,
    maxSplitShardCount: 60,
    appendMeta: true,
});
const exampleLogConfig = new alicloud.apigateway.LogConfig("example", {
    slsProject: example.projectName,
    slsLogStore: exampleStore.logstoreName,
    logType: "PROVIDER",
});
Copy
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
default = random.index.Integer("default",
    max=99999,
    min=10000)
example = alicloud.log.Project("example",
    project_name=f"{name}-{default['result']}",
    description=name)
example_store = alicloud.log.Store("example",
    project_name=example.project_name,
    logstore_name=f"{name}-{default['result']}",
    shard_count=3,
    auto_split=True,
    max_split_shard_count=60,
    append_meta=True)
example_log_config = alicloud.apigateway.LogConfig("example",
    sls_project=example.project_name,
    sls_log_store=example_store.logstore_name,
    log_type="PROVIDER")
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apigateway"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "terraform-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_default, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
			Max: 99999,
			Min: 10000,
		})
		if err != nil {
			return err
		}
		example, err := log.NewProject(ctx, "example", &log.ProjectArgs{
			ProjectName: pulumi.Sprintf("%v-%v", name, _default.Result),
			Description: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		exampleStore, err := log.NewStore(ctx, "example", &log.StoreArgs{
			ProjectName:        example.ProjectName,
			LogstoreName:       pulumi.Sprintf("%v-%v", name, _default.Result),
			ShardCount:         pulumi.Int(3),
			AutoSplit:          pulumi.Bool(true),
			MaxSplitShardCount: pulumi.Int(60),
			AppendMeta:         pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewLogConfig(ctx, "example", &apigateway.LogConfigArgs{
			SlsProject:  example.ProjectName,
			SlsLogStore: exampleStore.LogstoreName,
			LogType:     pulumi.String("PROVIDER"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "terraform-example";
    var @default = new Random.Index.Integer("default", new()
    {
        Max = 99999,
        Min = 10000,
    });

    var example = new AliCloud.Log.Project("example", new()
    {
        ProjectName = $"{name}-{@default.Result}",
        Description = name,
    });

    var exampleStore = new AliCloud.Log.Store("example", new()
    {
        ProjectName = example.ProjectName,
        LogstoreName = $"{name}-{@default.Result}",
        ShardCount = 3,
        AutoSplit = true,
        MaxSplitShardCount = 60,
        AppendMeta = true,
    });

    var exampleLogConfig = new AliCloud.ApiGateway.LogConfig("example", new()
    {
        SlsProject = example.ProjectName,
        SlsLogStore = exampleStore.LogstoreName,
        LogType = "PROVIDER",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.log.Store;
import com.pulumi.alicloud.log.StoreArgs;
import com.pulumi.alicloud.apigateway.LogConfig;
import com.pulumi.alicloud.apigateway.LogConfigArgs;
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 config = ctx.config();
        final var name = config.get("name").orElse("terraform-example");
        var default_ = new Integer("default", IntegerArgs.builder()
            .max(99999)
            .min(10000)
            .build());

        var example = new Project("example", ProjectArgs.builder()
            .projectName(String.format("%s-%s", name,default_.result()))
            .description(name)
            .build());

        var exampleStore = new Store("exampleStore", StoreArgs.builder()
            .projectName(example.projectName())
            .logstoreName(String.format("%s-%s", name,default_.result()))
            .shardCount(3)
            .autoSplit(true)
            .maxSplitShardCount(60)
            .appendMeta(true)
            .build());

        var exampleLogConfig = new LogConfig("exampleLogConfig", LogConfigArgs.builder()
            .slsProject(example.projectName())
            .slsLogStore(exampleStore.logstoreName())
            .logType("PROVIDER")
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
resources:
  default:
    type: random:integer
    properties:
      max: 99999
      min: 10000
  example:
    type: alicloud:log:Project
    properties:
      projectName: ${name}-${default.result}
      description: ${name}
  exampleStore:
    type: alicloud:log:Store
    name: example
    properties:
      projectName: ${example.projectName}
      logstoreName: ${name}-${default.result}
      shardCount: 3
      autoSplit: true
      maxSplitShardCount: 60
      appendMeta: true
  exampleLogConfig:
    type: alicloud:apigateway:LogConfig
    name: example
    properties:
      slsProject: ${example.projectName}
      slsLogStore: ${exampleStore.logstoreName}
      logType: PROVIDER
Copy

Create LogConfig Resource

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

Constructor syntax

new LogConfig(name: string, args: LogConfigArgs, opts?: CustomResourceOptions);
@overload
def LogConfig(resource_name: str,
              args: LogConfigArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def LogConfig(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              log_type: Optional[str] = None,
              sls_log_store: Optional[str] = None,
              sls_project: Optional[str] = None)
func NewLogConfig(ctx *Context, name string, args LogConfigArgs, opts ...ResourceOption) (*LogConfig, error)
public LogConfig(string name, LogConfigArgs args, CustomResourceOptions? opts = null)
public LogConfig(String name, LogConfigArgs args)
public LogConfig(String name, LogConfigArgs args, CustomResourceOptions options)
type: alicloud:apigateway:LogConfig
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. LogConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. LogConfigArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. LogConfigArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. LogConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. LogConfigArgs
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 logConfigResource = new AliCloud.ApiGateway.LogConfig("logConfigResource", new()
{
    LogType = "string",
    SlsLogStore = "string",
    SlsProject = "string",
});
Copy
example, err := apigateway.NewLogConfig(ctx, "logConfigResource", &apigateway.LogConfigArgs{
	LogType:     pulumi.String("string"),
	SlsLogStore: pulumi.String("string"),
	SlsProject:  pulumi.String("string"),
})
Copy
var logConfigResource = new LogConfig("logConfigResource", LogConfigArgs.builder()
    .logType("string")
    .slsLogStore("string")
    .slsProject("string")
    .build());
Copy
log_config_resource = alicloud.apigateway.LogConfig("logConfigResource",
    log_type="string",
    sls_log_store="string",
    sls_project="string")
Copy
const logConfigResource = new alicloud.apigateway.LogConfig("logConfigResource", {
    logType: "string",
    slsLogStore: "string",
    slsProject: "string",
});
Copy
type: alicloud:apigateway:LogConfig
properties:
    logType: string
    slsLogStore: string
    slsProject: string
Copy

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

LogType
This property is required.
Changes to this property will trigger replacement.
string
The type the of log. Valid values: PROVIDER.
SlsLogStore This property is required. string
The name of the Log Store.
SlsProject This property is required. string
The name of the Project.
LogType
This property is required.
Changes to this property will trigger replacement.
string
The type the of log. Valid values: PROVIDER.
SlsLogStore This property is required. string
The name of the Log Store.
SlsProject This property is required. string
The name of the Project.
logType
This property is required.
Changes to this property will trigger replacement.
String
The type the of log. Valid values: PROVIDER.
slsLogStore This property is required. String
The name of the Log Store.
slsProject This property is required. String
The name of the Project.
logType
This property is required.
Changes to this property will trigger replacement.
string
The type the of log. Valid values: PROVIDER.
slsLogStore This property is required. string
The name of the Log Store.
slsProject This property is required. string
The name of the Project.
log_type
This property is required.
Changes to this property will trigger replacement.
str
The type the of log. Valid values: PROVIDER.
sls_log_store This property is required. str
The name of the Log Store.
sls_project This property is required. str
The name of the Project.
logType
This property is required.
Changes to this property will trigger replacement.
String
The type the of log. Valid values: PROVIDER.
slsLogStore This property is required. String
The name of the Log Store.
slsProject This property is required. String
The name of the Project.

Outputs

All input properties are implicitly available as output properties. Additionally, the LogConfig 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 LogConfig Resource

Get an existing LogConfig 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?: LogConfigState, opts?: CustomResourceOptions): LogConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        log_type: Optional[str] = None,
        sls_log_store: Optional[str] = None,
        sls_project: Optional[str] = None) -> LogConfig
func GetLogConfig(ctx *Context, name string, id IDInput, state *LogConfigState, opts ...ResourceOption) (*LogConfig, error)
public static LogConfig Get(string name, Input<string> id, LogConfigState? state, CustomResourceOptions? opts = null)
public static LogConfig get(String name, Output<String> id, LogConfigState state, CustomResourceOptions options)
resources:  _:    type: alicloud:apigateway:LogConfig    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
LogType Changes to this property will trigger replacement. string
The type the of log. Valid values: PROVIDER.
SlsLogStore string
The name of the Log Store.
SlsProject string
The name of the Project.
LogType Changes to this property will trigger replacement. string
The type the of log. Valid values: PROVIDER.
SlsLogStore string
The name of the Log Store.
SlsProject string
The name of the Project.
logType Changes to this property will trigger replacement. String
The type the of log. Valid values: PROVIDER.
slsLogStore String
The name of the Log Store.
slsProject String
The name of the Project.
logType Changes to this property will trigger replacement. string
The type the of log. Valid values: PROVIDER.
slsLogStore string
The name of the Log Store.
slsProject string
The name of the Project.
log_type Changes to this property will trigger replacement. str
The type the of log. Valid values: PROVIDER.
sls_log_store str
The name of the Log Store.
sls_project str
The name of the Project.
logType Changes to this property will trigger replacement. String
The type the of log. Valid values: PROVIDER.
slsLogStore String
The name of the Log Store.
slsProject String
The name of the Project.

Import

Api Gateway Log Config can be imported using the id, e.g.

$ pulumi import alicloud:apigateway/logConfig:LogConfig example <log_type>
Copy

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

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.