This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New resource:
rollbar_team_user_association
(#63)
* Implement new resource: rollbar_team_user_association * don't set resource ID with the status
- Loading branch information
Showing
17 changed files
with
533 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
layout: "rollbar" | ||
page_title: "Rollbar: rollbar_team_user_association" | ||
sidebar_current: "docs-rollbar-resource-team-user-association" | ||
description: |- | ||
Provides a resource to create and manage the association between a team and user. | ||
--- | ||
|
||
# rollbar_team_user_association | ||
|
||
This resource is used to create and manage the association between a team and user. | ||
|
||
### Unique resource lifecycle | ||
|
||
If the specified `email` belongs to a new user: | ||
|
||
* For resource creation, an invitation will be sent to the user to create a Rollbar account. | ||
Once the account is created, the user will join the team. | ||
* For resource deletion, if the invitation has been accepted, and the user has joined the team, | ||
the user will be removed from the team. If the invitation has not been accepted, the invitation | ||
will be revoked. | ||
|
||
If the specified `email` belongs to an existing Rollbar user: | ||
|
||
* For resource creation, the user will be immediately added to the team. | ||
* For resource deletion, the user will be removed from the team. | ||
|
||
## Example Usage | ||
|
||
```hcl-terraform | ||
data "rollbar_team" "foobar" { | ||
id = "my_team_id" | ||
} | ||
data "rollbar_user" "foobar" { | ||
email = "[email protected]" | ||
} | ||
resource "rollbar_team_user_association" "foobar" { | ||
team_id = data.rollbar_team.foobar.id | ||
email = data.rollbar_user.foobar.email | ||
} | ||
``` | ||
|
||
```hcl-terraform | ||
resource "rollbar_team_user_association" "foobar" { | ||
team_id = 123456 | ||
email = "[email protected]" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `team_id` - (Required) `<string>` ID of existing team. | ||
* `email` - (Required) `<string>` Email address of an existing Rollbar user or a new user. | ||
|
||
## Attributes Reference | ||
|
||
* `user_id` - Email address of a user. | ||
* `invited_or_added` - Whether the user was either initially `invited` or `added` | ||
to the Rollbar team. | ||
* `invitation_status` - Status of the invitation. This attribute is set only if the user | ||
had to first be invited to Rollbar in order to join the team. | ||
* `invitation_id` - ID of the invitation. This attribute is set only if the user | ||
had to first be invited to Rollbar in order to join the team. | ||
|
||
## Import | ||
|
||
Existing team user association can be imported using a composite value of the team ID and email address | ||
separated by a colon. | ||
|
||
For example: | ||
|
||
```shell | ||
$ terraform import rollbar_team_user_association.follbar 123:[email protected] | ||
``` | ||
|
||
-> **IMPORTANT!** | ||
You can only import a team user association if the user has already joined the team. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package rollbar | ||
|
||
// UserNotFoundError is returned when searching for a user by a certain criteria. | ||
type UserNotFoundError struct { | ||
error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package rollbar | ||
|
||
import ( | ||
"fmt" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" | ||
"testing" | ||
) | ||
|
||
func TestAccRollbarTeamUserAssociationTest_importBasic(t *testing.T) { | ||
teamID := testAccConfig.GetTeamIDorAbort(t) | ||
email := testAccConfig.GetTeamEmailAddress(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { | ||
testAccPreCheck(t) | ||
}, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckRollbarTeamUserAssociation_basic(teamID, email), | ||
}, | ||
{ | ||
ResourceName: "rollbar_team_user_association.foobar", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateIdFunc: testAccRollbarTeamUserAssociationImportStateIdFunc("rollbar_team_user_association.foobar"), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccRollbarTeamUserAssociationImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { | ||
return func(s *terraform.State) (string, error) { | ||
rs, ok := s.RootModule().Resources[resourceName] | ||
if !ok { | ||
return "", fmt.Errorf("not found: %s", resourceName) | ||
} | ||
|
||
return fmt.Sprintf("%s:%s", rs.Primary.Attributes["team_id"], | ||
rs.Primary.Attributes["email"]), nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.