Skip to content

Commit f3d9be6

Browse files
authored
Merge pull request #44548 from its2shar/f-ri-ssmcontacts
Add ARN-based resource identity to SSMContacts Contact
2 parents 2df1874 + f6bb968 commit f3d9be6

File tree

8 files changed

+323
-4
lines changed

8 files changed

+323
-4
lines changed

.changelog/44548.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_ssmcontacts_contact: Add resource identity support
3+
```

internal/service/ssmcontacts/contact.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,19 @@ import (
2121
)
2222

2323
// @SDKResource("aws_ssmcontacts_contact", name="Contact")
24+
// @ArnIdentity
2425
// @Tags(identifierAttribute="arn")
2526
// @Testing(skipEmptyTags=true, skipNullTags=true)
27+
// @Testing(identityRegionOverrideTest=false)
2628
// @Testing(serialize=true)
29+
// @Testing(preIdentityVersion="v6.15.0")
2730
func ResourceContact() *schema.Resource {
2831
return &schema.Resource{
2932
CreateWithoutTimeout: resourceContactCreate,
3033
ReadWithoutTimeout: resourceContactRead,
3134
UpdateWithoutTimeout: resourceContactUpdate,
3235
DeleteWithoutTimeout: resourceContactDelete,
3336

34-
Importer: &schema.ResourceImporter{
35-
StateContext: schema.ImportStatePassthroughContext,
36-
},
37-
3837
Schema: map[string]*schema.Schema{
3938
names.AttrARN: {
4039
Type: schema.TypeString,

internal/service/ssmcontacts/contact_identity_gen_test.go

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

internal/service/ssmcontacts/service_package_gen.go

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

internal/service/ssmcontacts/ssmcontacts_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func TestAccSSMContacts_serial(t *testing.T) {
2222
"updateDisplayName": testAccContact_updateDisplayName,
2323
"tags": testAccSSMContactsContact_tagsSerial,
2424
"updateType": testAccContact_updateType,
25+
"identity": testAccSSMContactsContact_IdentitySerial,
2526
},
2627
"ContactDataSource": {
2728
acctest.CtBasic: testAccContactDataSource_basic,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: MPL-2.0
3+
4+
resource "aws_ssmcontacts_contact" "test" {
5+
alias = var.rName
6+
type = "PERSONAL"
7+
8+
depends_on = [aws_ssmincidents_replication_set.test]
9+
}
10+
11+
# testAccContactConfig_base
12+
13+
resource "aws_ssmincidents_replication_set" "test" {
14+
region {
15+
name = data.aws_region.current.region
16+
}
17+
}
18+
19+
data "aws_region" "current" {}
20+
21+
variable "rName" {
22+
description = "Name for resource"
23+
type = string
24+
nullable = false
25+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: MPL-2.0
3+
4+
resource "aws_ssmcontacts_contact" "test" {
5+
alias = var.rName
6+
type = "PERSONAL"
7+
8+
depends_on = [aws_ssmincidents_replication_set.test]
9+
}
10+
11+
# testAccContactConfig_base
12+
13+
resource "aws_ssmincidents_replication_set" "test" {
14+
region {
15+
name = data.aws_region.current.region
16+
}
17+
}
18+
19+
data "aws_region" "current" {}
20+
21+
variable "rName" {
22+
description = "Name for resource"
23+
type = string
24+
nullable = false
25+
}
26+
terraform {
27+
required_providers {
28+
aws = {
29+
source = "hashicorp/aws"
30+
version = "6.15.0"
31+
}
32+
}
33+
}
34+
35+
provider "aws" {}

website/docs/r/ssmcontacts_contact.html.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,27 @@ This resource exports the following attributes in addition to the arguments abov
6464

6565
## Import
6666

67+
In Terraform v1.12.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `identity` attribute. For example:
68+
69+
```terraform
70+
import {
71+
to = aws_ssmcontacts_contact.example
72+
identity = {
73+
"arn" = "arn:aws:ssm-contacts:us-west-2:123456789012:contact/example"
74+
}
75+
}
76+
77+
resource "aws_ssmcontacts_contact" "example" {
78+
### Configuration omitted for brevity ###
79+
}
80+
```
81+
82+
### Identity Schema
83+
84+
#### Required
85+
86+
- `arn` (String) Amazon Resource Name (ARN) of the contact.
87+
6788
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import SSM Contact using the `ARN`. For example:
6889

6990
```terraform

0 commit comments

Comments
 (0)