-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add RequiresReplace for organizationRoleMembershipResource to al…
…low changes (#36)
- Loading branch information
Showing
3 changed files
with
68 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,35 +34,65 @@ func TestAccOrganizationRoleMembershipResource(t *testing.T) { | |
// Create and Read testing | ||
{ | ||
Config: fmt.Sprintf(providerConfig+` | ||
data "sonatypeiq_organization" "sandbox" { | ||
name = "Sandbox Organization" | ||
} | ||
data "sonatypeiq_role" "developer" { | ||
name = "Developer" | ||
} | ||
resource "sonatypeiq_user" "user" { | ||
username = "%s" | ||
password = "randomthing" | ||
first_name = "Example" | ||
last_name = "User" | ||
email = "[email protected]" | ||
} | ||
resource "sonatypeiq_organization_role_membership" "test" { | ||
role_id = data.sonatypeiq_role.developer.id | ||
organization_id = data.sonatypeiq_organization.sandbox.id | ||
user_name = sonatypeiq_user.user.username | ||
} | ||
`, userName), | ||
data "sonatypeiq_organization" "sandbox" { | ||
name = "Sandbox Organization" | ||
} | ||
data "sonatypeiq_role" "developer" { | ||
name = "Developer" | ||
} | ||
resource "sonatypeiq_user" "user" { | ||
username = "%s" | ||
password = "randomthing" | ||
first_name = "Example" | ||
last_name = "User" | ||
email = "[email protected]" | ||
} | ||
resource "sonatypeiq_organization_role_membership" "test" { | ||
role_id = data.sonatypeiq_role.developer.id | ||
organization_id = data.sonatypeiq_organization.sandbox.id | ||
user_name = sonatypeiq_user.user.username | ||
} | ||
`, userName), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
// Verify application role membership | ||
resource.TestCheckResourceAttrSet("sonatypeiq_organization_role_membership.test", "id"), | ||
resource.TestCheckResourceAttr("sonatypeiq_organization_role_membership.test", "user_name", userName), | ||
), | ||
}, | ||
{ | ||
Config: fmt.Sprintf(providerConfig+` | ||
data "sonatypeiq_organization" "sandbox" { | ||
name = "Sandbox Organization" | ||
} | ||
data "sonatypeiq_role" "owner" { | ||
name = "Owner" | ||
} | ||
resource "sonatypeiq_user" "user" { | ||
username = "%s" | ||
password = "randomthing" | ||
first_name = "Example" | ||
last_name = "User" | ||
email = "[email protected]" | ||
} | ||
resource "sonatypeiq_organization_role_membership" "test" { | ||
role_id = data.sonatypeiq_role.owner.id | ||
organization_id = data.sonatypeiq_organization.sandbox.id | ||
user_name = sonatypeiq_user.user.username | ||
} | ||
`, userName), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
// Verify application role membership | ||
resource.TestCheckResourceAttr("sonatypeiq_organization_role_membership.test", "role_id", "1cddabf7fdaa47d6833454af10e0a3ef"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |