Skip to content

Commit 81760e2

Browse files
authored
Extract agent policy test config (#1439)
* Extract agent policy test config * make lint
1 parent 623e52a commit 81760e2

File tree

32 files changed

+572
-411
lines changed

32 files changed

+572
-411
lines changed

internal/fleet/agent_policy/acc_test.go

Lines changed: 136 additions & 411 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
kibana {}
4+
}
5+
6+
resource "elasticstack_fleet_agent_policy" "test_policy" {
7+
name = var.policy_name
8+
namespace = "default"
9+
description = "Test Agent Policy"
10+
monitor_logs = true
11+
monitor_metrics = false
12+
skip_destroy = var.skip_destroy
13+
}
14+
15+
data "elasticstack_fleet_enrollment_tokens" "test_policy" {
16+
policy_id = elasticstack_fleet_agent_policy.test_policy.policy_id
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "policy_name" {
2+
type = string
3+
description = "Name for the agent policy"
4+
}
5+
6+
variable "skip_destroy" {
7+
type = bool
8+
description = "Whether to skip destruction of the policy"
9+
default = false
10+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
kibana {}
4+
}
5+
6+
resource "elasticstack_fleet_agent_policy" "test_policy" {
7+
name = var.policy_name
8+
namespace = "default"
9+
description = "Test Agent Policy"
10+
monitor_logs = true
11+
monitor_metrics = false
12+
skip_destroy = var.skip_destroy
13+
global_data_tags = {
14+
tag1 = {
15+
string_value = "value1"
16+
}
17+
tag2 = {
18+
number_value = 1.1
19+
}
20+
}
21+
}
22+
23+
data "elasticstack_fleet_enrollment_tokens" "test_policy" {
24+
policy_id = elasticstack_fleet_agent_policy.test_policy.policy_id
25+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "policy_name" {
2+
type = string
3+
description = "Name for the agent policy"
4+
}
5+
6+
variable "skip_destroy" {
7+
type = bool
8+
description = "Whether to skip destruction of the policy"
9+
default = false
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
kibana {}
4+
}
5+
6+
resource "elasticstack_fleet_agent_policy" "test_policy" {
7+
name = var.policy_name
8+
namespace = "default"
9+
description = "This policy was updated"
10+
monitor_logs = false
11+
monitor_metrics = true
12+
skip_destroy = var.skip_destroy
13+
}
14+
15+
data "elasticstack_fleet_enrollment_tokens" "test_policy" {
16+
policy_id = elasticstack_fleet_agent_policy.test_policy.policy_id
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "policy_name" {
2+
type = string
3+
description = "Name for the agent policy"
4+
}
5+
6+
variable "skip_destroy" {
7+
type = bool
8+
description = "Whether to skip destruction of the policy"
9+
default = false
10+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
kibana {}
4+
}
5+
6+
resource "elasticstack_fleet_agent_policy" "test_policy" {
7+
name = var.policy_name
8+
namespace = "default"
9+
description = "This policy was updated"
10+
monitor_logs = false
11+
monitor_metrics = true
12+
skip_destroy = var.skip_destroy
13+
global_data_tags = {
14+
tag1 = {
15+
string_value = "value1a"
16+
}
17+
}
18+
}
19+
20+
data "elasticstack_fleet_enrollment_tokens" "test_policy" {
21+
policy_id = elasticstack_fleet_agent_policy.test_policy.policy_id
22+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "policy_name" {
2+
type = string
3+
description = "Name for the agent policy"
4+
}
5+
6+
variable "skip_destroy" {
7+
type = bool
8+
description = "Whether to skip destruction of the policy"
9+
default = false
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
kibana {}
4+
}
5+
6+
resource "elasticstack_fleet_agent_policy" "test_policy" {
7+
name = var.policy_name
8+
namespace = "default"
9+
description = "This policy was updated without global data tags"
10+
monitor_logs = false
11+
monitor_metrics = true
12+
skip_destroy = var.skip_destroy
13+
}
14+
15+
data "elasticstack_fleet_enrollment_tokens" "test_policy" {
16+
policy_id = elasticstack_fleet_agent_policy.test_policy.policy_id
17+
}

0 commit comments

Comments
 (0)