|
| 1 | +--- |
| 2 | +subcategory: "Audit Trail" |
| 3 | +page_title: "Scaleway: scaleway_audit_trail_event" |
| 4 | +--- |
| 5 | + |
| 6 | +# scaleway_audit_trail_event |
| 7 | + |
| 8 | +Use this data source to get a list of existing Audit Trail events. |
| 9 | +For more information refer to the [Audit Trail API documentation](https://www.scaleway.com/en/developers/api/audit-trail/). |
| 10 | + |
| 11 | +## Example Usage |
| 12 | + |
| 13 | +```hcl |
| 14 | +# Retrieve all audit trail events on the default organization |
| 15 | +data "scaleway_audit_trail_event" "find_all" { |
| 16 | +} |
| 17 | +
|
| 18 | +# Retrieve audit trail events on a specific organization |
| 19 | +data "scaleway_audit_trail_event" "find_by_org" { |
| 20 | + organization_id = "11111111-1111-1111-1111-111111111111" |
| 21 | +} |
| 22 | +
|
| 23 | +# Retrieve audit trail events on a specific project |
| 24 | +data "scaleway_audit_trail_event" "find_by_project" { |
| 25 | + project_id = "11111111-1111-1111-1111-111111111111" |
| 26 | +} |
| 27 | +
|
| 28 | +# Retrieve audit trail events for a specific type of resource |
| 29 | +data "scaleway_audit_trail_event" "find_by_resource_type" { |
| 30 | + resource_type = "instance_server" |
| 31 | +} |
| 32 | +
|
| 33 | +# Retrieve audit trail for a specific resource |
| 34 | +data "scaleway_audit_trail_event" "find_by_resource_id" { |
| 35 | + resource_id = "11111111-1111-1111-1111-111111111111" |
| 36 | +} |
| 37 | +
|
| 38 | +# Retrieve audit trail for a specific Scaleway product |
| 39 | +data "scaleway_audit_trail_event" "find_by_product_name" { |
| 40 | + product_name = "secret-manager" |
| 41 | +} |
| 42 | +
|
| 43 | +# Retrieve audit trail events with various filtering |
| 44 | +data "scaleway_audit_trail_event" "find_with_filters" { |
| 45 | + region = "fr-par" |
| 46 | + service_name = "instance" |
| 47 | + method_name = "CreateServer" |
| 48 | + principal_id = "11111111-1111-1111-1111-111111111111" |
| 49 | + source_ip = "192.0.2.1" |
| 50 | + status = 200 |
| 51 | + recorded_after = "2025-10-01T00:00:00Z" |
| 52 | + recorded_before = "2025-12-31T23:59:59Z" |
| 53 | + order_by = "recorded_at_desc" |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +## Argument Reference |
| 58 | + |
| 59 | +- `region` - (Optional) The [region](../guides/regions_and_zones.md#regions) you want to target. Defaults to the region specified in the [provider configuration](../index.md#region). |
| 60 | +- `organization_id` - (Optional. Defaults to [provider](../index.md#organization_id) `organization_id`) ID of the Organization containing the Audit Trail events. |
| 61 | +- `project_id` - (Optional) ID of the Project containing the Audit Trail events. |
| 62 | +- `resource_type` - (Optional) Type of the scaleway resources associated with the listed events. Possible values are: `secm_secret`, `secm_secret_version`, `kube_cluster`, `kube_pool`, `kube_node`, `kube_acl`, `keym_key`, `iam_user`, `iam_application`, `iam_group`, `iam_policy`, `iam_api_key`, `iam_ssh_key`, `iam_rule`, `iam_saml`, `iam_saml_certificate`, `secret_manager_secret`, `secret_manager_version`, `key_manager_key`, `account_user`, `account_organization`, `account_project`, `instance_server`, `instance_placement_group`, `instance_security_group`, `instance_volume`, `instance_snapshot`, `instance_image`, `apple_silicon_server`, `baremetal_server`, `baremetal_setting`, `ipam_ip`, `sbs_volume`, `sbs_snapshot`, `load_balancer_lb`, `load_balancer_ip`, `load_balancer_frontend`, `load_balancer_backend`, `load_balancer_route`, `load_balancer_acl`, `load_balancer_certificate`, `sfs_filesystem`, or `vpc_private_network`. |
| 63 | +- `resource_id` - (Optional) ID of the Scaleway resource associated with the listed events. |
| 64 | +- `product_name` - (Optional) Name of the Scaleway product in a hyphenated format. |
| 65 | +- `service_name` - (Optional) Name of the service of the API call performed. |
| 66 | +- `method_name` - (Optional) Name of the method of the API call performed. |
| 67 | +- `principal_id` - (Optional) ID of the User or IAM application at the origin of the event. |
| 68 | +- `source_ip` - (Optional) IP address at the origin of the event. |
| 69 | +- `status` - (Optional) HTTP status code of the request. |
| 70 | +- `recorded_after` - (Optional) The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default (Format ISO 8601). |
| 71 | +- `recorded_before` - (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Must be later than recorded_after. Returns `now` by default (Format ISO 8601). |
| 72 | +- `order_by` - (Optional) Defines the order in which events are returned. Possible values are `recorded_at_asc` and `recorded_at_desc`. Default value: `recorded_at_desc`. |
| 73 | + |
| 74 | + |
| 75 | +## Attributes Reference |
| 76 | + |
| 77 | +In addition to all arguments above, the following attributes are exported: |
| 78 | + |
| 79 | +- `events` - List of Audit Trail events matching the requested criteria. |
| 80 | + - `id` - ID of the event. (UUID format) |
| 81 | + - `recorded_at` - Timestamp of the event. (RFC 3339 format) |
| 82 | + - `locality` - Locality of the resource attached to the event. |
| 83 | + - `principal_id` - ID of the user or IAM application at the origin of the event. |
| 84 | + - `organization_id` - ID of the Organization containing the Audit Trail events. (UUID format) |
| 85 | + - `project_id` - Project of the resource attached to the event. (UUID format) |
| 86 | + - `source_ip` - IP address at the origin of the event. (IP address) |
| 87 | + - `user_agent` - User Agent at the origin of the event. |
| 88 | + - `product_name` - Scaleway product associated with the listed events in a hyphenated format. Possible values are: `secret-manager`, `key-manager`, `iam`, `kubernetes`, `account`, `apple-silicon`, `instance`, `baremetal`, `load-balancer`, or `edge-services`. |
| 89 | + - `service_name` - API name called to trigger the event. Possible values are: `scaleway.secret_manager.v1beta1.Api`, `scaleway.key_manager.v1alpha1.Api`, `scaleway.iam.v1alpha1.Api`, `scaleway.iam.v1alpha1.UnauthenticatedApi`, `scaleway.k8s.v1.Api`, `scaleway.account.v3.UserApi`, `scaleway.account.v3.OrganizationApi`, `scaleway.account.v2.GDPRApi`, `scaleway.apple_silicon.v1alpha1.Api`, `scaleway.instance.v1.Api`, `scaleway.baremetal.v1.Api`, or `scaleway.lb.v1.ZonedApi`. |
| 90 | + - `method_name` - API method called to trigger the event. |
| 91 | + - `resources` - List of resources attached to the event. |
| 92 | + - `id` - ID of the resource attached to the event. (UUID format) |
| 93 | + - `type` - Type of the Scaleway resource. |
| 94 | + - `name` - Name of the Scaleway resource. |
| 95 | + - `request_id` - Unique identifier of the request at the origin of the event. (UUID format) |
| 96 | + - `request_body` - Request at the origin of the event. |
| 97 | + - `status_code` - HTTP status code resulting of the API call. |
0 commit comments