Skip to content

Commit 77a78ce

Browse files
authored
Merge pull request #43704 from hashicorp/f-ri-ivs
Add ARN-based resource identity to `ivs`
2 parents c103e88 + ec4b667 commit 77a78ce

File tree

24 files changed

+1121
-12
lines changed

24 files changed

+1121
-12
lines changed

.changelog/43704.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```release-note:enhancement
2+
resource/aws_ivs_channel: Add resource identity support
3+
```
4+
```release-note:enhancement
5+
resource/aws_ivs_playback_key_pair: Add resource identity support
6+
```
7+
```release-note:enhancement
8+
resource/aws_ivs_recording_configuration: Add resource identity support
9+
```

docs/resource-tagging.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,10 @@ To override the common name, set the annotation `@Testing(tlsKeyDomain=<referenc
504504
For example, the API Gateway v2 Domain Name sets the variable `rName` to `acctest.RandomSubdomain()`
505505
and sets the annotation `@Testing(tlsKeyDomain=rName)` to reference it.
506506

507+
Some acceptance tests require a TLS ECDSA public key PEM.
508+
This can be included by setting the annotation `@Testing(tlsEcdsaPublicKeyPem=true)`.
509+
The Terraform variable name will be `rTlsEcdsaPublicKeyPem`.
510+
507511
Some acceptance tests related to networking require a random BGP ASN value.
508512
This can be included by setting the annotation `@Testing(randomBsgAsn="<low end>;<high end>)`,
509513
where `<low end>` and `<high end>` are the upper and lower bounds for the randomly-generated ASN value.

internal/generate/tests/annotations.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,22 @@ if err != nil {
460460
}
461461
}
462462

463+
if attr, ok := args.Keyword["tlsEcdsaPublicKeyPem"]; ok {
464+
if _, err := ParseBoolAttr("tlsEcdsaPublicKeyPem", attr); err != nil {
465+
return err
466+
} else {
467+
varName := "rTlsEcdsaPublicKeyPem"
468+
stuff.InitCodeBlocks = append(stuff.InitCodeBlocks, CodeBlock{
469+
Code: fmt.Sprintf(`privateKey := acctest.TLSECDSAPrivateKeyPEM(t, "P-384")
470+
%s, _ := acctest.TLSECDSAPublicKeyPEM(t, privateKey)`, varName),
471+
})
472+
stuff.AdditionalTfVars_[varName] = TFVar{
473+
GoVarName: varName,
474+
Type: TFVarTypeString,
475+
}
476+
}
477+
}
478+
463479
return nil
464480
}
465481

internal/service/ivs/channel.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ import (
2828

2929
// @SDKResource("aws_ivs_channel", name="Channel")
3030
// @Tags(identifierAttribute="id")
31+
// @ArnIdentity
32+
// @Testing(existsType="github.com/aws/aws-sdk-go-v2/service/ivs/types;awstypes.Channel")
33+
// @Testing(preIdentityVersion="v6.7.0")
34+
// @Testing(generator=false)
3135
func ResourceChannel() *schema.Resource {
3236
return &schema.Resource{
3337
CreateWithoutTimeout: resourceChannelCreate,
3438
ReadWithoutTimeout: resourceChannelRead,
3539
UpdateWithoutTimeout: resourceChannelUpdate,
3640
DeleteWithoutTimeout: resourceChannelDelete,
3741

38-
Importer: &schema.ResourceImporter{
39-
StateContext: schema.ImportStatePassthroughContext,
40-
},
41-
4242
Timeouts: &schema.ResourceTimeout{
4343
Create: schema.DefaultTimeout(5 * time.Minute),
4444
Update: schema.DefaultTimeout(5 * time.Minute),

internal/service/ivs/channel_identity_gen_test.go

Lines changed: 261 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/service/ivs/generate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
//go:generate go run ../../generate/tags/main.go -KVTValues -ListTags -ServiceTagsMap -UpdateTags
55
//go:generate go run ../../generate/servicepackage/main.go
6+
//go:generate go run ../../generate/identitytests/main.go
67
// ONLY generate directives and package declaration! Do not add anything else to this file.
78

89
package ivs

internal/service/ivs/ivs_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func TestAccIVS_serial(t *testing.T) {
1818
"update": testAccPlaybackKeyPair_update,
1919
"tags": testAccPlaybackKeyPair_tags,
2020
acctest.CtDisappears: testAccPlaybackKeyPair_disappears,
21+
"identity": testAccIVSPlaybackKeyPair_IdentitySerial,
2122
},
2223
}
2324

internal/service/ivs/playback_key_pair.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ import (
2424

2525
// @SDKResource("aws_ivs_playback_key_pair", name="Playback Key Pair")
2626
// @Tags(identifierAttribute="id")
27+
// @ArnIdentity
28+
// @Testing(existsType="github.com/aws/aws-sdk-go-v2/service/ivs/types;awstypes.PlaybackKeyPair")
29+
// @Testing(preIdentityVersion="v6.7.0")
30+
// @Testing(serialize=true)
31+
// @Testing(generator=false)
32+
// @Testing(tlsEcdsaPublicKeyPem=true)
33+
// @Testing(importIgnore="public_key")
34+
// @Testing(plannableImportAction=Replace)
2735
func ResourcePlaybackKeyPair() *schema.Resource {
2836
return &schema.Resource{
2937
CreateWithoutTimeout: resourcePlaybackKeyPairCreate,
3038
ReadWithoutTimeout: resourcePlaybackKeyPairRead,
3139
DeleteWithoutTimeout: resourcePlaybackKeyPairDelete,
3240

33-
Importer: &schema.ResourceImporter{
34-
StateContext: schema.ImportStatePassthroughContext,
35-
},
36-
3741
Timeouts: &schema.ResourceTimeout{
3842
Create: schema.DefaultTimeout(5 * time.Minute),
3943
Delete: schema.DefaultTimeout(5 * time.Minute),

0 commit comments

Comments
 (0)