generated from hashicorp/terraform-provider-scaffolding-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fddcbca
commit 8ec09b9
Showing
11 changed files
with
103 additions
and
44 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 was deleted.
Oops, something went wrong.
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,42 @@ | ||
import { | ||
id = "default" | ||
to = unleash_project.default_project | ||
} | ||
|
||
resource "unleash_project" "default_project" { | ||
id = "default" | ||
name = "Taken over by Terraform" | ||
description = "This was default project" | ||
} | ||
|
||
import { | ||
id = 1 | ||
to = unleash_user.admin_user | ||
} | ||
|
||
resource "unleash_user" "admin_user" { | ||
root_role = 1 | ||
username = "admin" | ||
} | ||
|
||
import { | ||
id = "default" | ||
to = unleash_project_access.default_project_access | ||
} | ||
|
||
data "unleash_role" "project_owner_role" { | ||
name = "Owner" | ||
} | ||
|
||
resource "unleash_project_access" "default_project_access" { | ||
project = "default" | ||
roles = [ | ||
{ | ||
role = data.unleash_role.project_owner_role.id | ||
users = [ | ||
unleash_user.admin_user.id | ||
] | ||
groups = [] | ||
}, | ||
] | ||
} |
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 |
---|---|---|
|
@@ -74,6 +74,34 @@ func TestAccUserResource(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccUserResourceImport(t *testing.T) { | ||
if os.Getenv("UNLEASH_ENTERPRISE") != "true" { | ||
t.Skip("Skipping enterprise tests") | ||
} | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccSampleUserResource("Test User"), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("unleash_user.the_newbie", "id"), | ||
resource.TestCheckResourceAttr("unleash_user.the_newbie", "name", "Test User"), | ||
resource.TestCheckResourceAttr("unleash_user.the_newbie", "email", "[email protected]"), | ||
resource.TestCheckResourceAttr("unleash_user.the_newbie", "root_role", "2"), | ||
// TODO test the remote object matches https://developer.hashicorp.com/terraform/plugin/testing/testing-patterns#basic-test-to-verify-attributes | ||
), | ||
}, | ||
{ | ||
Config: `resource "unleash_user" "the_newbie" {}`, | ||
ResourceName: "unleash_user.the_newbie", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccCheckUserResourceDestroy(s *terraform.State) error { | ||
// TODO retrieve the client from Provider configuration rather than creating a new client | ||
configuration := unleash.NewConfiguration() | ||
|