-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_create_sqs_queue.fp
97 lines (83 loc) · 2.94 KB
/
test_create_sqs_queue.fp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
pipeline "test_create_sqs_queue" {
title = "Test Create SQS Queue"
description = "Test the create_sqs_queue pipeline."
tags = {
type = "test"
}
param "cred" {
type = string
description = local.cred_param_description
default = "default"
}
param "region" {
type = string
description = local.region_param_description
}
param "queue_name" {
type = string
description = "The name of the Amazon SQS queue to create."
default = "flowpipe-test-${uuid()}"
}
param "attributes" {
type = string
description = "A map of attributes to set."
default = jsonencode({
"DelaySeconds" = "10"
})
}
step "pipeline" "create_sqs_queue" {
pipeline = pipeline.create_sqs_queue
args = {
cred = param.cred
region = param.region
queue_name = param.queue_name
}
}
step "pipeline" "set_sqs_queue_attributes" {
if = !is_error(step.pipeline.create_sqs_queue)
depends_on = [step.pipeline.create_sqs_queue]
pipeline = pipeline.set_sqs_queue_attributes
args = {
cred = param.cred
region = param.region
queue_url = step.pipeline.create_sqs_queue.output.queue_url
attributes = param.attributes
}
}
step "pipeline" "get_sqs_queue_attributes" {
if = !is_error(step.pipeline.create_sqs_queue)
depends_on = [step.pipeline.set_sqs_queue_attributes]
pipeline = pipeline.get_sqs_queue_attributes
args = {
cred = param.cred
region = param.region
queue_url = step.pipeline.create_sqs_queue.output.queue_url
}
}
step "pipeline" "delete_sqs_queue" {
if = !is_error(step.pipeline.create_sqs_queue)
depends_on = [step.pipeline.get_sqs_queue_attributes]
pipeline = pipeline.delete_sqs_queue
args = {
region = param.region
queue_url = step.pipeline.create_sqs_queue.output.queue_url
}
}
output "created_queue_url" {
description = "The ARN of the created queue."
value = step.pipeline.create_sqs_queue.output.queue_url
}
output "queue_attributes" {
description = "The attributes of the created queue."
value = step.pipeline.get_sqs_queue_attributes.output
}
output "test_results" {
description = "Test results for each step."
value = {
"create_sqs_queue" = !is_error(step.pipeline.create_sqs_queue) ? "pass" : "fail: ${error_message(step.pipeline.create_sqs_queue)}"
"set_sqs_queue_attributes" = !is_error(step.pipeline.set_sqs_queue_attributes) ? "pass" : "fail: ${error_message(step.pipeline.set_sqs_queue_attributes)}"
"get_sqs_queue_attributes" = !is_error(step.pipeline.get_sqs_queue_attributes) ? "pass" : "fail: ${error_message(step.pipeline.get_sqs_queue_attributes)}"
"delete_sqs_queue" = !is_error(step.pipeline.delete_sqs_queue) ? "pass" : "fail: ${error_message(step.pipeline.delete_sqs_queue)}"
}
}
}