Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
  • Loading branch information
pschun committed Mar 3, 2023
1 parent 8135751 commit 5523d88
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
12 changes: 6 additions & 6 deletions internal/service/ssmincidents/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ import (
)

func FindReplicationSetByID(context context.Context, client *ssmincidents.Client, arn string) (*types.ReplicationSet, error) {
in := &ssmincidents.GetReplicationSetInput{
input := &ssmincidents.GetReplicationSetInput{
Arn: aws.String(arn),
}
out, err := client.GetReplicationSet(context, in)
output, err := client.GetReplicationSet(context, input)
if err != nil {
var notFoundError *types.ResourceNotFoundException
if errors.As(err, &notFoundError) {
return nil, &resource.NotFoundError{
LastError: err,
LastRequest: in,
LastRequest: input,
}
}

return nil, err
}

if out == nil || out.ReplicationSet == nil {
return nil, tfresource.NewEmptyResultError(in)
if output == nil || output.ReplicationSet == nil {
return nil, tfresource.NewEmptyResultError(input)
}

return out.ReplicationSet, nil
return output.ReplicationSet, nil
}
53 changes: 27 additions & 26 deletions website/docs/r/ssmincidents_replication_set.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ subcategory: "AWS Systems Manager Incident Manager incidents"
layout: "aws"
page_title: "AWS: aws_ssmincidents_replication_set"
description: |-
Terraform resource for managing an incident replication set for AWS Systems Manager Incident Manager.
Terraform resource for managing an incident replication set for AWS Systems Manager Incident Manager.
---

# Resource: aws_ssmincidents_replication_set

Provides a resource for managing a replication set in AWS Systems Manager Incident Manager.

## Example Usage
~> **NOTE:** Deleting a replication set also deletes all Incident Manager related data including response plans, incident records, contacts and escalation plans.

~> **NOTE:** When you delete a replication set, Incident Manager deletes all data associated with the replication set. This includes response plans, incident records, contacts, and escalation plans.
## Example Usage

### Basic Usage

Expand All @@ -30,7 +30,7 @@ resource "aws_ssmincidents_replication_set" "replicationSetName" {
}
```

Add an AWS Region to a replication set. (You can add only one Region at a time.)
Add a Region to a replication set. (You can add only one Region at a time.)

```terraform
resource "aws_ssmincidents_replication_set" "replicationSetName" {
Expand All @@ -44,7 +44,7 @@ resource "aws_ssmincidents_replication_set" "replicationSetName" {
}
```

Delete an AWS Region from a replication set. (You can delete only one Region at a time.)
Delete a Region from a replication set. (You can delete only one Region at a time.)

```terraform
resource "aws_ssmincidents_replication_set" "replicationSetName" {
Expand All @@ -54,7 +54,7 @@ resource "aws_ssmincidents_replication_set" "replicationSetName" {
}
```

## Using an AWS customer managed key with a replication set
## Basic Usage with an AWS Customer Managed Key

Create a replication set with an AWS Key Management Service (AWS KMS) customer manager key:

Expand All @@ -76,58 +76,59 @@ resource "aws_ssmincidents_replication_set" "replicationSetName" {

## Argument Reference

~> **NOTE:** You must use one of the AWS Regions specified for the replication set in the specification for a Terraform provider. This is important when you perform complex update operations.
~> **NOTE:** The Region specified by a Terraform provider must always be one of the Regions specified for the replication set. This is especially important when you perform complex update operations.

~> **NOTE:** After you create a replication set, you can only add or delete one Region at a time.
~> **NOTE:** After a replication set is created, you can add or delete only one Region at a time.

~> **NOTE:** Incident Manager doesn’t support updates to the customer managed key associated with a replication set. Instead, for a replication set with multiple Regions, you must first delete the Region from the replication set. Then, you add the Region back to the replication set with a different customer managed key in a separate `terraform apply` operation. For a replication set with only one Region, you must delete and recreate the entire replication set. To do this, comment out the replication set and all associated response plans. Then run the `terraform apply` command to recreate the replication set with the new customer managed key.
~> **NOTE:** Incident Manager does not support updating the customer managed key associated with a replication set. Instead, for a replication set with multiple Regions, you must first delete a Region from the replication set, then re-add it with a different customer managed key in separate `terraform apply` operations. For a replication set with only one Region, the entire replication set must be deleted and recreated. To do this, comment out the replication set and all response plans, and then run the `terraform apply` command to recreate the replication set with the new customer managed key.

~> **NOTE:** You must either associate all Regions in a replication set with either an AWS owned key or a customer managed key. To change between an AWS owned key and a customer managed key, you must delete and recreate the replication set and all of its associated data.
~> **NOTE:** You must either use AWS-owned keys on all regions of a replication set, or customer managed keys. To change between an AWS owned key and a customer managed key, a replication set and it associated data must be deleted and recreated.

~> **NOTE:** We recommend that you create the customer managed keys you need with the `terraform apply` command before you create the replication set. You can also create the keys and replication set at the same time with the same `terraform apply` command. Otherwise, to delete a replication set, you must run separate `terraform apply` commands to first delete the replication set and then the AWS KMS keys used by that replication set. If these recommendations are not followed, Terraform may accidentally delete the AWS KMS keys before the replication set is deleted, which will cause an error to be reported. In that case, you must manually restore the deleted key from the AWS Management Console before you can delete the replication set.
~> **NOTE:** If possible, create all the customer managed keys you need (using the `terraform apply` command) before you create the replication set, or create the keys and replication set in the same `terraform apply` command. Otherwise, to delete a replication set, you must run one `terraform apply` command to delete the replication set and another to delete the AWS KMS keys used by the replication set. Deleting the AWS KMS keys before deleting the replication set results in an error. In that case, you must manually reenable the deleted key using the AWS Management Console before you can delete the replication set.

The `region` configuration block is required and supports the following arguments:

* `name` - (Required) The name of the Region, such as `ap-southeast-2`.
* `kms_key_arn` - (Optional) The Amazon Resource Name (ARN) for the customer managed key. If omitted, AWS manages the AWS KMS keys for you with an AWS owned key. This is indicated by a default value of `DefaultKey`.
* `kms_key_arn` - (Optional) The Amazon Resource name (ARN) of the customer managed key. If omitted, AWS manages the AWS KMS keys for you, using an AWS owned key, as indicated by a default value of `DefaultKey`.

The following arguments are optional:

* `tags` - Tags applied to the replication set.

For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html) in the *AWS Systems Manager Incident Manager API Reference*.
For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).

## Attributes Reference

The following attributes are exported in addition to the previously mentioned arguments.
In addition to the preceding arguments, the following attributes are exported:

* `arn` - The ARN of the replication set.
* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block).
* `created_by` - The ARN of the user who created the replication set.
* `created_time` - A timestamp showing when the replication set was created.
* `deletion_protected` - If `true`, the last region in a replication set cannot be deleted.
* `last_modified_by` - The ARN of the user who last modified the replication set.
* `last_modified_by` - A timestamp showing when the replication set was last modified.
* `last_modified_time` - When the replication set was last modified
* `status` - The overall status of a replication set.
* Valid Values: `ACTIVE` | `CREATING` | `UPDATING` | `DELETING` | `FAILED`

The `region` configuration block also exports the following attributes for each Region:
In addition to the preceding arguments, the `region` configuration block exports the following attributes for each Region:

* `status` - The current status of the replication set in a Region.
* `status` - The current status of the Region.
* Valid Values: `ACTIVE` | `CREATING` | `UPDATING` | `DELETING` | `FAILED`
* `status_message` - More information about the status of a replication set.
* `status_update_time` - A timestamp showing when the Region status was last updated.
* `status_message` - More information about the status of a Region.

## Timeouts

~> **NOTE:** When you create or delete replication sets with large numbers of response plans and data, the operation can take longer to complete. We recommend that you configure custom timeouts for larger replication sets.

~> **NOTE:** Each additional Region that you include when you create a replication set increases the amount of time required to complete the operation.
~> **NOTE:** `Update` and `Delete` operations applied to replication sets with large numbers of response plans and data take longer to complete. We recommend that you configure custom timeouts for this situation.

[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts)
~> **NOTE:** Each additional Region included when you create a replication set increases the amount of time required to complete the `create` operation.

The default time for each of the following is 120m:
[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts):

* `create`
* `update`
* `delete`
* `create` - (Default `120m`)
* `update` - (Default `120m`)
* `delete` - (Default `120m`)

## Import

Expand Down

0 comments on commit 5523d88

Please sign in to comment.