Skip to content

Commit

Permalink
use v2 api
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 committed Aug 21, 2020
1 parent e350c06 commit 5aaf9c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
35 changes: 11 additions & 24 deletions aws/resource_aws_backup_vault_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/backup"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

func resourceAwsBackupVaultNotifications() *schema.Resource {
Expand All @@ -22,10 +22,13 @@ func resourceAwsBackupVaultNotifications() *schema.Resource {

Schema: map[string]*schema.Schema{
"backup_vault_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9\-\_\.]{1,50}$`), "must consist of lowercase letters, numbers, and hyphens."),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.All(
validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9\-\_\.]$`), "must consist of lowercase letters, numbers, and hyphens."),
validation.StringLenBetween(1, 50),
),
},
"sns_topic_arn": {
Type: schema.TypeString,
Expand All @@ -38,24 +41,8 @@ func resourceAwsBackupVaultNotifications() *schema.Resource {
Required: true,
ForceNew: true,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice([]string{
backup.VaultEventBackupJobStarted,
backup.VaultEventBackupJobCompleted,
backup.VaultEventBackupJobSuccessful,
backup.VaultEventBackupJobFailed,
backup.VaultEventBackupJobExpired,
backup.VaultEventRestoreJobStarted,
backup.VaultEventRestoreJobSuccessful,
backup.VaultEventRestoreJobCompleted,
backup.VaultEventRestoreJobFailed,
backup.VaultEventCopyJobFailed,
backup.VaultEventCopyJobStarted,
backup.VaultEventCopyJobSuccessful,
backup.VaultEventRecoveryPointModified,
backup.VaultEventBackupPlanCreated,
backup.VaultEventBackupPlanModified,
}, false),
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(backup.VaultEvent_Values(), false),
},
},
"backup_vault_arn": {
Expand Down
8 changes: 4 additions & 4 deletions aws/resource_aws_backup_vault_notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package aws

import (
"fmt"
"github.com/hashicorp/go-multierror"
"log"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/backup"
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func init() {
Expand Down

0 comments on commit 5aaf9c3

Please sign in to comment.