You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: group generated tag test options with headings (#41612)
As tag test generation has expanded across the provider, the number of parameters which can be passed to the tags test annotation has grown significantly. Given the number of options, the contributor documentation on this section has become difficult to read in its entirety. This change bundles the various parameters into related groups and adds headings to break up the available options into smaller standalone sections.
Copy file name to clipboardExpand all lines: docs/resource-tagging.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -472,6 +472,8 @@ If a resource or data source type supports tags but does not use transparent tag
472
472
473
473
Additional `@Testing(...)` parameters can be used to control the generated tests.
474
474
475
+
##### Required Argument parameters
476
+
475
477
Most testing configurations take a single parameter, often a name or a domain name.
476
478
The most common case is parameter `rName` with a value generated by `sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)`, so this is the default.
477
479
If no `rName` is required, add the annotation `@Testing(generator=false)`.
@@ -495,6 +497,8 @@ and sets the annotation `@Testing(tlsKeyDomain=rName)` to reference it.
495
497
No additional parameters can be defined currently.
496
498
If additional parameters are required, and cannot be derived from `rName`, the resource type must use manually created acceptance tests as described below.
497
499
500
+
##### Exists and Destroy parameters
501
+
498
502
Most `Exists` functions used in acceptance tests take a pointer to the returned API object.
499
503
To specify the type of this parameter, use the annotion `@Testing(existsType=<reference>)`.
500
504
This references a Go type and package path with optional package alias, using the format
@@ -508,6 +512,11 @@ For example, the S3 Object uses
508
512
Some services or resource types are using a new variant of the standard `Exists` and `DestroyCheck` functions that use `acctest.ProviderMeta` internally, and thus take a `testing.T` as a parameter.
509
513
In that case, add the annotations `@Testing(existsTakesT=true)` and `@Testing(destroyTakesT=true)`, respectively.
510
514
515
+
Some resource types use the no-op `CheckDestroy` function `acctest.CheckDestroyNoop`.
516
+
Use the annotation `@Testing(checkDestroyNoop=true)`.
517
+
518
+
##### Import parameters
519
+
511
520
The generated acceptance tests use `ImportState` steps.
512
521
In most cases, these will work as-is.
513
522
To ignore the values of certain parameters when importing, set the annotation `@Testing(importIgnore="...")` to a list of the parameter names separated by semi-colons (`;`).
@@ -517,29 +526,36 @@ If the identifier can be retrieved from a specific resource attribute, use the a
517
526
If the identifier can be retrieved from a `resource.ImportStateIdFunc`, use the annotation `@Testing(importStateIdFunc=<func name>)`.
518
527
If the resource type does not support importing, use the annotation `@Testing(noImport=true)`.
519
528
520
-
If the tests need to be serialized, use the annotion `@Testing(serialize=true)`.
529
+
##### Serialization parameters
530
+
531
+
If the tests need to be serialized, use the annotation `@Testing(serialize=true)`.
521
532
If a delay is needed between serialized tests, also use the annotation `@Testing(serializeDelay=<duration>)` with a duration in the format used by [`time.ParseDuration()`](https://pkg.go.dev/time#ParseDuration).
522
533
For example, 3 minutes and 30 seconds is `3m30s`.
523
534
535
+
##### Empty and Null Tag parameters
536
+
524
537
Some services do not support tags with an empty string value.
525
538
In that case, use the annotation `@Testing(skipEmptyTags=true)`.
526
539
527
540
Some services do not support tags with an null string value.
528
541
In that case, use the annotation `@Testing(skipNullTags=true)`.
529
542
530
-
Some resource types use the no-op `CheckDestroy` function `acctest.CheckDestroyNoop`.
531
-
Use the annotation `@Testing(checkDestroyNoop=true)`.
543
+
##### Tag Update parameters
532
544
533
545
For some resource types, tags cannot be modified without recreating the resource.
534
546
Use the annotation `@Testing(tagsUpdateForceNew=true)`.
535
547
536
548
Resource types which pass the result of `getTagsIn` directly onto their Update Input may have an error where ignored tags are not correctly excluded from the update.
537
549
Use the annotation `@Testing(tagsUpdateGetTagsIn=true)`.
538
550
551
+
##### Resource Identifier parameters
552
+
539
553
Some tests read the tag values directly from the AWS API.
540
554
If the resource type does not specify `identifierAttribute` in its `@Tags` annotation, specify a `@Testing(tagsIdentifierAttribute=<attribute name>)` annotation to identify which attribute value should be used by the `listTags` function.
541
555
If a resource type is also needed for the `listTags` function, also specify the `tagsResourceType` annotation.
542
556
557
+
##### Tag Removal parameters
558
+
543
559
At least one resource type, the Service Catalog Provisioned Product, does not support removing tags.
544
560
This is likely an error on the AWS side.
545
561
Add the annotation `@Testing(noRemoveTags=true)` as a workaround.
0 commit comments