-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CodeArts/Deploy): support group permission management
- Loading branch information
Showing
6 changed files
with
404 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
subcategory: "CodeArts Deploy" | ||
layout: "huaweicloud" | ||
page_title: "HuaweiCloud: huaweicloud_codearts_deploy_group_permission" | ||
description: |- | ||
Manages a CodeArts deploy group permission resource within HuaweiCloud. | ||
--- | ||
|
||
# huaweicloud_codearts_deploy_group_permission | ||
|
||
Manages a CodeArts deploy group permission resource within HuaweiCloud. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "project_id" {} | ||
variable "group_id" {} | ||
variable "role_id" {} | ||
resource "huaweicloud_codearts_deploy_group_permission" "test" { | ||
project_id = var.project_id | ||
group_id = var.group_id | ||
role_id = var.role_id | ||
permission_name = "can_add_host" | ||
permission_value = false | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource. | ||
If omitted, the provider-level region will be used. | ||
Changing this creates a new resource. | ||
|
||
* `project_id` - (Required, String, ForceNew) Specifies the project ID. | ||
Changing this creates a new resource. | ||
|
||
* `group_id` - (Required, String, ForceNew) Specifies the group ID. | ||
Changing this creates a new resource. | ||
|
||
* `role_id` - (Required, String, ForceNew) Specifies the role ID. | ||
Changing this creates a new resource. | ||
|
||
* `permission_name` - (Required, String, ForceNew) Specifies the permission name. | ||
Valid values are **can_view**, **can_edit**, **can_delete**, **can_add_host**, **can_manage**, and **can_copy**. | ||
|
||
Changing this creates a new resource. | ||
|
||
* `permission_value` - (Optional, Bool, ForceNew) Specifies whether to enable the permission. | ||
Changing this creates a new resource. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. |
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
37 changes: 37 additions & 0 deletions
37
...s/acceptance/codeartsdeploy/resource_huaweicloud_codearts_deploy_group_permission_test.go
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,37 @@ | ||
package codeartsdeploy | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" | ||
) | ||
|
||
func TestAccDeployGroupPermissionModify_basic(t *testing.T) { | ||
rName := acceptance.RandomAccResourceName() | ||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.TestAccPreCheck(t) }, | ||
ProviderFactories: acceptance.TestAccProviderFactories, | ||
CheckDestroy: nil, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDeployGroupPermissionModify_basic(rName), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDeployGroupPermissionModify_basic(rName string) string { | ||
return fmt.Sprintf(` | ||
%s | ||
resource "huaweicloud_codearts_deploy_group_permission" "test" { | ||
project_id = huaweicloud_codearts_deploy_group.test.project_id | ||
group_id = huaweicloud_codearts_deploy_group.test.id | ||
role_id = try(huaweicloud_codearts_deploy_group.test.permission_matrix[2].role_id, "") | ||
permission_name = "can_add_host" | ||
permission_value = false | ||
}`, testDeployGroup_basic(rName)) | ||
} |
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.