Trail

class Trail : KotlinCustomResource

Provides a ActionTrail Trail resource. For information about alicloud actiontrail trail and how to use it, see What is Resource Alicloud ActionTrail Trail.

NOTE: Available since v1.95.0. NOTE: You can create a trail to deliver events to Log Service, Object Storage Service (OSS), or both. Before you call this operation to create a trail, make sure that the following requirements are met.

  • Deliver events to Log Service: A project is created in Log Service.

  • Deliver events to OSS: A bucket is created in OSS.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.ram.RamFunctions;
import com.pulumi.alicloud.ram.inputs.GetRolesArgs;
import com.pulumi.alicloud.actiontrail.Trail;
import com.pulumi.alicloud.actiontrail.TrailArgs;
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("tf-example");
final var exampleRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
final var exampleAccount = AlicloudFunctions.getAccount();
var exampleProject = new Project("exampleProject", ProjectArgs.builder()
.description("tf actiontrail example")
.build());
final var exampleRoles = RamFunctions.getRoles(GetRolesArgs.builder()
.nameRegex("AliyunServiceRoleForActionTrail")
.build());
var exampleTrail = new Trail("exampleTrail", TrailArgs.builder()
.trailName(name)
.slsWriteRoleArn(exampleRoles.applyValue(getRolesResult -> getRolesResult.roles()[0].arn()))
.slsProjectArn(exampleProject.name().applyValue(name -> String.format("acs:log:%s:%s:project/%s", exampleRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),exampleAccount.applyValue(getAccountResult -> getAccountResult.id()),name)))
.build());
}
}

Import

Action trail can be imported using the id or trail_name, e.g.

$ pulumi import alicloud:actiontrail/trail:Trail default abc12345678

Properties

Link copied to clipboard
val eventRw: Output<String>?

Indicates whether the event is a read or a write event. Valid values: Read, Write, and All. Default to Write.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Specifies whether to create a multi-account trail. Valid values:true: Create a multi-account trail.false: Create a single-account trail. It is the default value.

Link copied to clipboard
val mnsTopicArn: Output<String>?

Field mns_topic_arn has been deprecated from version 1.118.0.

Link copied to clipboard
val name: Output<String>

Field name has been deprecated from version 1.95.0. Use trail_name instead.

Link copied to clipboard
val ossBucketName: Output<String>?

The OSS bucket to which the trail delivers logs. Ensure that this is an existing OSS bucket.

Link copied to clipboard
val ossKeyPrefix: Output<String>?

The prefix of the specified OSS bucket name. This parameter can be left empty.

Link copied to clipboard
val ossWriteRoleArn: Output<String>?

The unique ARN of the Oss role.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val roleName: Output<String>

Field name has been deprecated from version 1.118.0.

Link copied to clipboard
val slsProjectArn: Output<String>?

The unique ARN of the Log Service project. Ensure that sls_project_arn is valid .

Link copied to clipboard
val slsWriteRoleArn: Output<String>

The unique ARN of the Log Service role.

Link copied to clipboard
val status: Output<String>?

The status of ActionTrail Trail. After creation, tracking is turned on by default, and you can set the status value to Disable to turn off tracking. Valid values: Enable, Disable. Default to Enable.

Link copied to clipboard
val trailName: Output<String>

The name of the trail to be created, which must be unique for an account.

Link copied to clipboard
val trailRegion: Output<String>

The regions to which the trail is applied. Default to All.

Link copied to clipboard
val urn: Output<String>