@robinmordasiewicz/f5xc-terraform-mcp 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,459 @@
1
+ ---
2
+ page_title: "Guide: Addon Service Activation"
3
+ subcategory: "Guides"
4
+ description: |-
5
+ Learn how to activate F5XC addon services using Terraform.
6
+ Covers Bot Defense, Client Side Defense, WAAP, and more.
7
+ ---
8
+
9
+ # Addon Service Activation
10
+
11
+ This guide walks you through activating F5 Distributed Cloud addon services using Terraform. By the end, you'll understand how to:
12
+
13
+ - **Check activation eligibility** - Determine if an addon can be activated
14
+ - **Activate self-service addons** - Bot Defense, Client Side Defense, etc.
15
+ - **Handle managed activation** - Services requiring sales contact
16
+ - **Monitor activation status** - Track subscription state changes
17
+
18
+ ## Overview
19
+
20
+ F5 Distributed Cloud addon services are additional security and performance features that can be activated for your tenant. These include:
21
+
22
+ | Addon Service | Description | Tier Required |
23
+ | ------------------------------------ | --------------------------------------------- | ------------- |
24
+ | `f5xc-bot-defense-standard` | Protect applications from automated attacks | STANDARD |
25
+ | `f5xc-bot-defense-advanced` | Bot defense with advanced ML detection | ADVANCED |
26
+ | `f5xc-client-side-defense-standard` | Protect against Magecart and formjacking | STANDARD |
27
+ | `f5xc-waap-standard` | Web App and API Protection with API Discovery | STANDARD |
28
+ | `f5xc-waap-advanced` | WAAP with full API security features | ADVANCED |
29
+ | `f5xc-malicious-user-detection` | Identify malicious user behavior patterns | ADVANCED |
30
+ | `f5xc-synthetic-monitoring` | Monitor application availability | STANDARD |
31
+
32
+ ### Activation Types
33
+
34
+ Addon services have different activation types that determine how they can be activated:
35
+
36
+ ```text
37
+ ┌─────────────────────────────────────────────────────────────────────┐
38
+ │ Activation Types │
39
+ ├─────────────────────────────────────────────────────────────────────┤
40
+ │ │
41
+ │ SELF-ACTIVATION │
42
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
43
+ │ │ Check Status │───►│ Create │───►│ Active │ │
44
+ │ │ (AS_NONE) │ │ Subscription │ │ (AS_SUBSCRIBED) │ │
45
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
46
+ │ User can activate directly via Terraform │
47
+ │ │
48
+ │ PARTIALLY MANAGED │
49
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
50
+ │ │ Check Status │───►│ Request │───►│ SRE Review │ │
51
+ │ │ (AS_NONE) │ │ Subscription │ │ (AS_PENDING) │ │
52
+ │ └──────────────┘ └──────────────┘ └──────┬───────┘ │
53
+ │ │ │
54
+ │ ┌──────▼───────┐ │
55
+ │ │ Active │ │
56
+ │ │ (AS_SUBSCRIBED) │ │
57
+ │ └──────────────┘ │
58
+ │ User initiates, SRE team processes │
59
+ │ │
60
+ │ FULLY MANAGED │
61
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
62
+ │ │ Contact │───►│ Sales │───►│ F5 Activates │ │
63
+ │ │ F5 Sales │ │ Agreement │ │ Addon │ │
64
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
65
+ │ Requires sales engagement │
66
+ │ │
67
+ └─────────────────────────────────────────────────────────────────────┘
68
+ ```
69
+
70
+ ## Prerequisites
71
+
72
+ Before you begin, ensure you have:
73
+
74
+ - **Terraform >= 1.0** - The F5XC provider requires Terraform 1.0 or later
75
+ - **F5 Distributed Cloud Account** - Sign up at <https://www.f5.com/cloud/products/distributed-cloud-console>
76
+ - **API Credentials** - Token or P12 certificate authentication configured
77
+ - **Appropriate Subscription Tier** - Most addon services require ADVANCED tier
78
+
79
+ ### Authentication Setup
80
+
81
+ Configure one of these authentication methods via environment variables:
82
+
83
+ #### Option 1: API Token (Recommended for development)
84
+
85
+ ```bash
86
+ export F5XC_API_URL="https://your-tenant.console.ves.volterra.io"
87
+ export F5XC_API_TOKEN="your-api-token"
88
+ ```
89
+
90
+ #### Option 2: P12 Certificate (Recommended for production)
91
+
92
+ ```bash
93
+ export F5XC_API_URL="https://your-tenant.console.ves.volterra.io"
94
+ export F5XC_P12_FILE="/path/to/your-credentials.p12"
95
+ export F5XC_P12_PASSWORD="your-p12-password" # pragma: allowlist secret
96
+ ```
97
+
98
+ ## Quick Start
99
+
100
+ ### Step 1: Clone the Repository
101
+
102
+ ```bash
103
+ git clone https://github.com/robinmordasiewicz/terraform-provider-f5xc.git
104
+ cd terraform-provider-f5xc/examples/guides/addon-activation
105
+ ```
106
+
107
+ ### Step 2: Configure Your Deployment
108
+
109
+ ```bash
110
+ cp terraform.tfvars.example terraform.tfvars
111
+ ```
112
+
113
+ Edit `terraform.tfvars` to enable the addon services you want to activate:
114
+
115
+ ```hcl
116
+ # Enable Bot Defense activation
117
+ enable_bot_defense = true
118
+
119
+ # Enable Client Side Defense
120
+ enable_client_side_defense = false
121
+ ```
122
+
123
+ ### Step 3: Initialize and Apply
124
+
125
+ ```bash
126
+ terraform init
127
+ terraform plan
128
+ terraform apply
129
+ ```
130
+
131
+ ## Checking Activation Eligibility
132
+
133
+ Before attempting to activate an addon service, check if it's available for your tenant.
134
+
135
+ ### Using the Activation Status Data Source
136
+
137
+ ```hcl
138
+ # Check if Bot Defense can be activated
139
+ data "f5xc_addon_service_activation_status" "bot_defense" {
140
+ addon_service = "f5xc-bot-defense-standard"
141
+ }
142
+
143
+ output "bot_defense_status" {
144
+ value = {
145
+ state = data.f5xc_addon_service_activation_status.bot_defense.state
146
+ can_activate = data.f5xc_addon_service_activation_status.bot_defense.can_activate
147
+ message = data.f5xc_addon_service_activation_status.bot_defense.message
148
+ }
149
+ }
150
+ ```
151
+
152
+ ### State Values
153
+
154
+ | State | Description | Can Activate? |
155
+ | --------------- | ---------------------- | -------------------- |
156
+ | `AS_NONE` | Service not subscribed | Yes |
157
+ | `AS_PENDING` | Activation in progress | No (wait) |
158
+ | `AS_SUBSCRIBED` | Already active | Already done |
159
+ | `AS_ERROR` | Subscription error | No (contact support) |
160
+
161
+ ### Querying Addon Service Details
162
+
163
+ ```hcl
164
+ # Get detailed information about an addon service
165
+ data "f5xc_addon_service" "bot_defense" {
166
+ name = "f5xc-bot-defense-standard"
167
+ }
168
+
169
+ output "addon_details" {
170
+ value = {
171
+ display_name = data.f5xc_addon_service.bot_defense.display_name
172
+ tier = data.f5xc_addon_service.bot_defense.tier
173
+ activation_type = data.f5xc_addon_service.bot_defense.activation_type
174
+ }
175
+ }
176
+ ```
177
+
178
+ ## Self-Activation Workflow
179
+
180
+ For addon services with `self` activation type, you can activate directly via Terraform.
181
+
182
+ ### Basic Self-Activation
183
+
184
+ ```hcl
185
+ # Step 1: Check if we can activate
186
+ data "f5xc_addon_service_activation_status" "bot_defense" {
187
+ addon_service = "f5xc-bot-defense-standard"
188
+ }
189
+
190
+ # Step 2: Create subscription only if available
191
+ resource "f5xc_addon_subscription" "bot_defense" {
192
+ count = data.f5xc_addon_service_activation_status.bot_defense.can_activate && data.f5xc_addon_service_activation_status.bot_defense.state == "AS_NONE" ? 1 : 0
193
+
194
+ name = "bot-defense-subscription"
195
+ namespace = "system"
196
+
197
+ addon_service {
198
+ name = "f5xc-bot-defense-standard"
199
+ namespace = "shared"
200
+ }
201
+ }
202
+
203
+ output "activation_result" {
204
+ value = length(f5xc_addon_subscription.bot_defense) > 0 ? "Activated" : "Not activated (check status)"
205
+ }
206
+ ```
207
+
208
+ ### Multiple Addon Activation
209
+
210
+ ```hcl
211
+ locals {
212
+ # Define the addons you want to activate
213
+ addons_to_activate = [
214
+ "f5xc-bot-defense-standard",
215
+ "f5xc-client-side-defense-standard",
216
+ "f5xc-waap-standard",
217
+ ]
218
+ }
219
+
220
+ # Check activation status for each
221
+ data "f5xc_addon_service_activation_status" "addons" {
222
+ for_each = toset(local.addons_to_activate)
223
+ addon_service = each.value
224
+ }
225
+
226
+ # Create subscriptions for available addons
227
+ resource "f5xc_addon_subscription" "addons" {
228
+ for_each = {
229
+ for addon in local.addons_to_activate :
230
+ addon => addon
231
+ if data.f5xc_addon_service_activation_status.addons[addon].can_activate && data.f5xc_addon_service_activation_status.addons[addon].state == "AS_NONE"
232
+ }
233
+
234
+ name = "${replace(replace(each.value, "f5xc-", ""), "-standard", "")}-subscription"
235
+ namespace = "system"
236
+
237
+ addon_service {
238
+ name = each.value
239
+ namespace = "shared"
240
+ }
241
+ }
242
+ ```
243
+
244
+ ## Waiting for Activation
245
+
246
+ Some addons may take time to activate, especially those with partial management. Here are patterns for handling this.
247
+
248
+ ### Pattern 1: Using terraform_data with Precondition
249
+
250
+ ```hcl
251
+ # Check status after subscription
252
+ data "f5xc_addon_service_activation_status" "bot_defense_status" {
253
+ addon_service = "f5xc-bot-defense-standard"
254
+
255
+ depends_on = [f5xc_addon_subscription.bot_defense]
256
+ }
257
+
258
+ # Validate activation succeeded
259
+ resource "terraform_data" "validate_activation" {
260
+ lifecycle {
261
+ precondition {
262
+ condition = data.f5xc_addon_service_activation_status.bot_defense_status.state == "AS_SUBSCRIBED"
263
+ error_message = "Bot Defense activation not yet complete. Current state: ${data.f5xc_addon_service_activation_status.bot_defense_status.state}"
264
+ }
265
+ }
266
+ }
267
+ ```
268
+
269
+ ### Pattern 2: Using time_sleep for Simple Delays
270
+
271
+ ```hcl
272
+ resource "f5xc_addon_subscription" "bot_defense" {
273
+ name = "bot-defense-subscription"
274
+ namespace = "system"
275
+
276
+ addon_service {
277
+ name = "f5xc-bot-defense-standard"
278
+ namespace = "shared"
279
+ }
280
+ }
281
+
282
+ # Wait for activation to propagate
283
+ resource "time_sleep" "wait_for_activation" {
284
+ depends_on = [f5xc_addon_subscription.bot_defense]
285
+
286
+ create_duration = "30s"
287
+ }
288
+
289
+ # Use the addon feature after waiting
290
+ resource "f5xc_http_loadbalancer" "with_bot_defense" {
291
+ depends_on = [time_sleep.wait_for_activation]
292
+ # ... configuration with bot defense enabled
293
+ }
294
+ ```
295
+
296
+ ### Pattern 3: External Verification Script
297
+
298
+ For critical deployments, you may want to verify activation before proceeding:
299
+
300
+ ```hcl
301
+ resource "null_resource" "verify_activation" {
302
+ depends_on = [f5xc_addon_subscription.bot_defense]
303
+
304
+ provisioner "local-exec" {
305
+ command = <<-EOT
306
+ for i in {1..30}; do
307
+ status=$(curl -s -H "Authorization: APIToken $F5XC_API_TOKEN" \
308
+ "$F5XC_API_URL/api/web/namespaces/system/addon_services/f5xc-bot-defense-standard/activation-status" \
309
+ | jq -r '.state')
310
+ if [ "$status" = "AS_SUBSCRIBED" ]; then
311
+ echo "Activation complete!"
312
+ exit 0
313
+ fi
314
+ echo "Waiting for activation... (attempt $i/30, status: $status)"
315
+ sleep 10
316
+ done
317
+ echo "Activation timeout"
318
+ exit 1
319
+ EOT
320
+ }
321
+ }
322
+ ```
323
+
324
+ ## Managed Activation Workflow
325
+
326
+ For addon services requiring sales contact, use Terraform to monitor status after F5 activates the service.
327
+
328
+ ### Verifying Managed Addon Status
329
+
330
+ ```hcl
331
+ # For managed addons, just check status (don't try to create subscription)
332
+ data "f5xc_addon_service_activation_status" "managed_addon" {
333
+ addon_service = "some_managed_addon"
334
+ }
335
+
336
+ output "managed_addon_status" {
337
+ value = {
338
+ active = data.f5xc_addon_service_activation_status.managed_addon.state == "AS_SUBSCRIBED"
339
+ message = data.f5xc_addon_service_activation_status.managed_addon.message
340
+ }
341
+ }
342
+
343
+ # Use conditional logic based on activation status
344
+ resource "f5xc_http_loadbalancer" "with_managed_feature" {
345
+ count = data.f5xc_addon_service_activation_status.managed_addon.state == "AS_SUBSCRIBED" ? 1 : 0
346
+
347
+ # Configuration that uses the managed addon feature
348
+ name = "lb-with-managed-addon"
349
+ namespace = "production"
350
+ # ... rest of configuration
351
+ }
352
+ ```
353
+
354
+ ## Using Addon Features
355
+
356
+ Once an addon is activated, you can use its features in your configurations.
357
+
358
+ ### Bot Defense in HTTP Load Balancer
359
+
360
+ ```hcl
361
+ resource "f5xc_http_loadbalancer" "with_bot_defense" {
362
+ depends_on = [f5xc_addon_subscription.bot_defense]
363
+
364
+ name = "my-protected-app"
365
+ namespace = "production"
366
+
367
+ domains = ["app.example.com"]
368
+
369
+ default_route_pools {
370
+ pool {
371
+ name = f5xc_origin_pool.backend.name
372
+ namespace = "production"
373
+ }
374
+ weight = 1
375
+ }
376
+
377
+ # Enable Bot Defense
378
+ bot_defense {
379
+ policy {
380
+ name = "my-bot-policy"
381
+ namespace = "shared"
382
+ }
383
+ }
384
+
385
+ http {
386
+ port = 80
387
+ }
388
+ }
389
+ ```
390
+
391
+ ### Client Side Defense
392
+
393
+ ```hcl
394
+ resource "f5xc_http_loadbalancer" "with_csd" {
395
+ depends_on = [f5xc_addon_subscription.client_side_defense]
396
+
397
+ name = "my-protected-app"
398
+ namespace = "production"
399
+
400
+ domains = ["app.example.com"]
401
+
402
+ # Enable Client Side Defense
403
+ enable_client_side_defense = true
404
+
405
+ # ... rest of configuration
406
+ }
407
+ ```
408
+
409
+ ## Troubleshooting
410
+
411
+ ### Common Issues
412
+
413
+ #### Access denied when creating subscription
414
+
415
+ - Verify your API token has addon management permissions
416
+ - Check that your subscription tier supports the addon
417
+
418
+ #### Activation stuck in AS_PENDING
419
+
420
+ - For partially managed addons, contact F5 support
421
+ - For self-activation, wait and retry after a few minutes
422
+
423
+ #### State shows AS_ERROR
424
+
425
+ - Check F5XC console for detailed error messages
426
+ - Contact F5 support with your tenant ID
427
+
428
+ ### Debugging Tips
429
+
430
+ ```hcl
431
+ # Output detailed status for debugging
432
+ output "debug_addon_status" {
433
+ value = {
434
+ addon_service = "f5xc-bot-defense-standard"
435
+ state = data.f5xc_addon_service_activation_status.bot_defense.state
436
+ can_activate = data.f5xc_addon_service_activation_status.bot_defense.can_activate
437
+ message = data.f5xc_addon_service_activation_status.bot_defense.message
438
+ }
439
+ }
440
+ ```
441
+
442
+ ## Best Practices
443
+
444
+ 1. **Always check eligibility first** - Use the activation status data source before attempting activation
445
+ 2. **Use conditional resource creation** - Only create subscriptions when `can_activate` is true
446
+ 3. **Handle dependencies properly** - Use `depends_on` to ensure addons are active before using features
447
+ 4. **Monitor activation state** - For partially managed addons, monitor the state for completion
448
+ 5. **Document addon requirements** - Clearly document which addons your configuration requires
449
+
450
+ ## Complete Example
451
+
452
+ See the [addon-activation example](https://github.com/robinmordasiewicz/terraform-provider-f5xc/tree/main/examples/guides/addon-activation) for a complete, working Terraform configuration.
453
+
454
+ ## Related Resources
455
+
456
+ - [f5xc_addon_service Data Source](../data-sources/addon_service)
457
+ - [f5xc_addon_service_activation_status Data Source](../data-sources/addon_service_activation_status)
458
+ - [f5xc_addon_subscription Resource](../resources/addon_subscription)
459
+ - [HTTP Load Balancer Resource](../resources/http_loadbalancer)
@@ -49,8 +49,6 @@ resource "f5xc_api_credential" "example" {
49
49
 
50
50
  <a id="name"></a>&#x2022; [`name`](#name) - Required String<br>Name of the API Credential. Must be unique within the namespace
51
51
 
52
- <a id="namespace"></a>&#x2022; [`namespace`](#namespace) - Required String<br>Namespace where the API Credential will be created
53
-
54
52
  <a id="annotations"></a>&#x2022; [`annotations`](#annotations) - Optional Map<br>Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata
55
53
 
56
54
  <a id="description"></a>&#x2022; [`description`](#description) - Optional String<br>Human readable description for the object
@@ -59,6 +57,8 @@ resource "f5xc_api_credential" "example" {
59
57
 
60
58
  <a id="labels"></a>&#x2022; [`labels`](#labels) - Optional Map<br>Labels is a user defined key value map that can be attached to resources for organization and filtering
61
59
 
60
+ <a id="namespace"></a>&#x2022; [`namespace`](#namespace) - Optional String<br>Namespace for the API Credential. For this resource type, namespace should be empty or omitted
61
+
62
62
  ### Spec Argument Reference
63
63
 
64
64
  <a id="password"></a>&#x2022; [`password`](#password) - Optional String<br>Password. Password is used for generating an API certificate P12 bundle user can use to protect access to it. this password will not be saved/persisted anywhere in the system. Applicable for credential type API_CERTIFICATE Users have to use this password when they use the certificate, e.g. in curl or while adding to key chain