alicloud_vpc_flow_log

Provides a Vpc Flow Log resource. While it uses alicloud_vpc_flow_log to build a vpc flow log resource, it will be active by default.

For information about Vpc Flow Log and how to use it, see What is Flow Log.

Example Usage

Basic Usage

variable "name" {
  default = "tf-example"
}
data "alicloud_resource_manager_resource_groups" "default" {
  status = "OK"
}
resource "alicloud_vpc" "example" {
  vpc_name   = var.name
  cidr_block = "10.4.0.0/16"
}
resource "random_uuid" "example" {
}
resource "alicloud_log_project" "example" {
  name        = substr("tf-example-${replace(random_uuid.example.result, "-", "")}", 0, 16)
  description = var.name
}

resource "alicloud_log_store" "example" {
  project               = alicloud_log_project.example.name
  name                  = var.name
  shard_count           = 3
  auto_split            = true
  max_split_shard_count = 60
  append_meta           = true
}

resource "alicloud_vpc_flow_log" "example" {
  flow_log_name        = var.name
  log_store_name       = alicloud_log_store.example.name
  description          = var.name
  traffic_path         = ["all"]
  project_name         = alicloud_log_project.example.name
  resource_type        = "VPC"
  resource_group_id    = data.alicloud_resource_manager_resource_groups.default.ids.0
  resource_id          = alicloud_vpc.example.id
  aggregation_interval = "1"
  traffic_type         = "All"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Vpc Flow Log can be imported using the id, e.g.

$ terraform import alicloud_vpc_flow_log.example <id>