Skip to content

Commit

Permalink
refactor: renamed invite to invitation
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar López committed May 15, 2021
1 parent abbdcec commit bf803d5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 41 deletions.
12 changes: 6 additions & 6 deletions aws/resource_aws_macie2_invitation_accepter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ resource "aws_macie2_account" "admin" {
resource "aws_macie2_account" "member" {}
resource "aws_macie2_member" "member" {
provider = "awsalternate"
account_id = data.aws_caller_identity.member.account_id
email = %[1]q
invite = true
invite_message = "This is a message of the invite"
depends_on = [aws_macie2_account.admin]
provider = "awsalternate"
account_id = data.aws_caller_identity.member.account_id
email = %[1]q
invite = true
invitation_message = "This is a message of the invite"
depends_on = [aws_macie2_account.admin]
}
resource "aws_macie2_invitation_accepter" "member" {
Expand Down
12 changes: 6 additions & 6 deletions aws/resource_aws_macie2_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ func resourceAwsMacie2Member() *schema.Resource {
Optional: true,
Computed: true,
},
"invite_disable_email_notification": {
"invitation_disable_email_notification": {
Type: schema.TypeString,
Optional: true,
},
"invite_message": {
"invitation_message": {
Type: schema.TypeString,
Optional: true,
},
Expand Down Expand Up @@ -143,10 +143,10 @@ func resourceMacie2MemberCreate(ctx context.Context, d *schema.ResourceData, met
AccountIds: []*string{aws.String(d.Id())},
}

if v, ok := d.GetOk("invite_disable_email_notification"); ok {
if v, ok := d.GetOk("invitation_disable_email_notification"); ok {
inputInvite.DisableEmailNotification = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("invite_message"); ok {
if v, ok := d.GetOk("invitation_message"); ok {
inputInvite.Message = aws.String(v.(string))
}

Expand Down Expand Up @@ -260,10 +260,10 @@ func resourceMacie2MemberUpdate(ctx context.Context, d *schema.ResourceData, met
AccountIds: []*string{aws.String(d.Id())},
}

if v, ok := d.GetOk("invite_disable_email_notification"); ok {
if v, ok := d.GetOk("invitation_disable_email_notification"); ok {
inputInvite.DisableEmailNotification = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("invite_message"); ok {
if v, ok := d.GetOk("invitation_message"); ok {
inputInvite.Message = aws.String(v.(string))
}

Expand Down
35 changes: 21 additions & 14 deletions aws/resource_aws_macie2_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func testAccAwsMacie2Member_basic(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusEnabled),
),
},
{
Expand Down Expand Up @@ -114,6 +115,7 @@ func testAccAwsMacie2Member_invite(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusEnabled),
),
},
{
Expand All @@ -127,14 +129,15 @@ func testAccAwsMacie2Member_invite(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusEnabled),
),
},
{
Config: testAccAwsMacieMemberConfigInvite(email, true),
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"invite_message"},
ImportStateVerifyIgnore: []string{"invitation_message"},
},
},
})
Expand Down Expand Up @@ -167,6 +170,7 @@ func testAccAwsMacie2Member_inviteRemoved(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusEnabled),
),
},
{
Expand All @@ -180,14 +184,15 @@ func testAccAwsMacie2Member_inviteRemoved(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusEnabled),
),
},
{
Config: testAccAwsMacieMemberConfigInvite(email, false),
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"invite_message"},
ImportStateVerifyIgnore: []string{"invitation_message"},
},
},
})
Expand Down Expand Up @@ -220,6 +225,7 @@ func testAccAwsMacie2Member_status(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusEnabled),
),
},
{
Expand All @@ -233,14 +239,15 @@ func testAccAwsMacie2Member_status(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "account_id", dataSourceAlternate, "account_id"),
testAccCheckResourceAttrRfc3339(resourceName, "invited_at"),
testAccCheckResourceAttrRfc3339(resourceName, "updated_at"),
resource.TestCheckResourceAttr(resourceName, "status", macie2.MacieStatusPaused),
),
},
{
Config: testAccAwsMacieMemberConfigStatus(email, macie2.MacieStatusPaused, true),
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"invite_message"},
ImportStateVerifyIgnore: []string{"invitation_message"},
},
},
})
Expand Down Expand Up @@ -393,11 +400,11 @@ resource "aws_macie2_account" "member" {
}
resource "aws_macie2_member" "member" {
account_id = data.aws_caller_identity.member.account_id
email = %[1]q
invite = %[2]t
invite_message = "This is a message of the invitation"
depends_on = [aws_macie2_account.admin]
account_id = data.aws_caller_identity.member.account_id
email = %[1]q
invite = %[2]t
invitation_message = "This is a message of the invitation"
depends_on = [aws_macie2_account.admin]
}
`, email, invite)
}
Expand All @@ -417,12 +424,12 @@ resource "aws_macie2_account" "member" {
}
resource "aws_macie2_member" "member" {
account_id = data.aws_caller_identity.member.account_id
email = %[1]q
status = %[2]q
invite = %[3]t
invite_message = "This is a message of the invitation"
depends_on = [aws_macie2_account.admin]
account_id = data.aws_caller_identity.member.account_id
email = %[1]q
status = %[2]q
invite = %[3]t
invitation_message = "This is a message of the invitation"
depends_on = [aws_macie2_account.admin]
}
resource "aws_macie2_invitation_accepter" "member" {
Expand Down
14 changes: 7 additions & 7 deletions website/docs/r/macie2_invitation_accepter.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ resource "aws_macie2_account" "primary" {
resource "aws_macie2_account" "member" {}
resource "aws_macie2_member" "primary" {
provider = "awsalternate"
account_id = "ACCOUNT ID"
email = "EMAIL"
invite = true
invite_message = "Message of the invite"
depends_on = [aws_macie2_account.primary]
provider = "awsalternate"
account_id = "ACCOUNT ID"
email = "EMAIL"
invite = true
invitation_message = "Message of the invite"
depends_on = [aws_macie2_account.primary]
}
resource "aws_macie2_invitation_accepter" "test" {
resource "aws_macie2_invitation_accepter" "member" {
administrator_account_id = "ADMINISTRATOR ACCOUNT ID"
depends_on = [aws_macie2_member.primary]
}
Expand Down
16 changes: 8 additions & 8 deletions website/docs/r/macie2_member.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Provides a resource to manage an [Amazon Macie Member](https://docs.aws.amazon.c
resource "aws_macie2_account" "example" {}
resource "aws_macie2_member" "example" {
account_id = "AWS ACCOUNT ID"
email = "EMAIL"
invite = true
invite_message = "Message of the invitation"
invite_disable_email_notification = true
depends_on = [aws_macie2_account.example]
account_id = "AWS ACCOUNT ID"
email = "EMAIL"
invite = true
invitation_message = "Message of the invitation"
invitation_disable_email_notification = true
depends_on = [aws_macie2_account.example]
}
```

Expand All @@ -34,8 +34,8 @@ The following arguments are supported:
* `tags` - (Optional) A map of key-value pairs that specifies the tags to associate with the account in Amazon Macie.
* `status` - (Optional) Specifies the status for the account. To enable Amazon Macie and start all Macie activities for the account, set this value to `ENABLED`. Valid values are `ENABLED` or `PAUSED`.
* `invite` - (Optional) Send an invitation to a member
* `invite_message` - (Optional) A custom message to include in the invitation. Amazon Macie adds this message to the standard content that it sends for an invitation.
* `invite_disable_email_notification` - (Optional) Specifies whether to send an email notification to the root user of each account that the invitation will be sent to. This notification is in addition to an alert that the root user receives in AWS Personal Health Dashboard. To send an email notification to the root user of each account, set this value to `true`.
* `invitation_message` - (Optional) A custom message to include in the invitation. Amazon Macie adds this message to the standard content that it sends for an invitation.
* `invitation_disable_email_notification` - (Optional) Specifies whether to send an email notification to the root user of each account that the invitation will be sent to. This notification is in addition to an alert that the root user receives in AWS Personal Health Dashboard. To send an email notification to the root user of each account, set this value to `true`.

## Attributes Reference

Expand Down

0 comments on commit bf803d5

Please sign in to comment.