diff --git a/docs-templates/index.md.tmpl b/docs-templates/index.md.tmpl index bdca567..6815a25 100644 --- a/docs-templates/index.md.tmpl +++ b/docs-templates/index.md.tmpl @@ -26,7 +26,7 @@ terraform { provider "stackguardian" { api_key = "" # Replace this with your API key org_name = "" # Replace this with your organization name - api_uri = "https://testapi.qa.stackguardian.io" # Use testapi instead of production for testing + api_uri = "https://api.app.stackguardian.io" } # Create a StackGuardian Workflow Group diff --git a/docs/index.md b/docs/index.md index 8be744e..8de05a8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -35,7 +35,7 @@ terraform { provider "stackguardian" { api_key = "" # Replace this with your API key org_name = "" # Replace this with your organization name - api_uri = "https://testapi.qa.stackguardian.io" # Use testapi instead of production for testing + api_uri = "https://api.app.stackguardian.io" } # Create a StackGuardian Workflow Group diff --git a/internal/resource/role/resource_test.go b/internal/resource/role/resource_test.go index 9661d66..cbf34d3 100644 --- a/internal/resource/role/resource_test.go +++ b/internal/resource/role/resource_test.go @@ -11,7 +11,7 @@ import ( const ( testAccResource = ` resource "stackguardian_workflow_group" "example_workflow_group" { - resource_name = "example-workflow-group" + resource_name = "example-workflow-group-role" description = "Example of terraform-provider-stackguardian for Workflow Group" tags = ["example-tag"] } @@ -40,7 +40,7 @@ resource "stackguardian_role" "example_role" { testAccResourceUpdate = ` resource "stackguardian_workflow_group" "example_workflow_group" { - resource_name = "example-workflow-group" + resource_name = "example-workflow-group-role" description = "Example of terraform-provider-stackguardian for Workflow Group" tags = ["example-tag"] } diff --git a/internal/resource/role_assignment/model.go b/internal/resource/role_assignment/model.go index e0357a4..0e7ddc9 100644 --- a/internal/resource/role_assignment/model.go +++ b/internal/resource/role_assignment/model.go @@ -50,9 +50,16 @@ func (m *RoleAssignmentResourceModel) ToGetAPIModel(ctx context.Context) (*sgsdk func BuildAPIModelToRoleAssignmentModel(apiResponse *sgsdkgo.AddUserToOrganization) (*RoleAssignmentResourceModel, diag.Diagnostics) { entityTypeValue := flatteners.String(string(*apiResponse.EntityType.Ptr())) - userID := strings.Split(apiResponse.UserId, "/") + + var userID string + if strings.HasPrefix(apiResponse.UserId, "local/") { + userID = strings.Split(apiResponse.UserId, "/")[1] + } else { + userID = apiResponse.UserId + } + RoleModel := &RoleAssignmentResourceModel{ - UserId: flatteners.String(userID[len(userID)-1]), + UserId: flatteners.String(userID), Role: flatteners.String(apiResponse.Role), EntityType: entityTypeValue, } diff --git a/internal/resource/role_assignment/resource_test.go b/internal/resource/role_assignment/resource_test.go index ea7d7e2..6a193e4 100644 --- a/internal/resource/role_assignment/resource_test.go +++ b/internal/resource/role_assignment/resource_test.go @@ -17,7 +17,7 @@ resource "stackguardian_workflow_group" "example_workflow_group" { } resource "stackguardian_role" "example_role" { - resource_name = "example-role" + resource_name = "example-role-roleassignment" description = "Example of terraform-provider-stackguardian for a Role" tags = [ "example-org", @@ -53,7 +53,7 @@ resource "stackguardian_workflow_group" "example_workflow_group" { } resource "stackguardian_role" "example_role" { - resource_name = "example-role" + resource_name = "example-role-roleassignment" description = "Example of terraform-provider-stackguardian for a Role" tags = [ "example-org",