-
Notifications
You must be signed in to change notification settings - Fork 163
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 application permission management
- Loading branch information
Showing
7 changed files
with
601 additions
and
16 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,82 @@ | ||
--- | ||
subcategory: "CodeArts Deploy" | ||
layout: "huaweicloud" | ||
page_title: "HuaweiCloud: huaweicloud_codearts_deploy_application_permission" | ||
description: |- | ||
Manages a CodeArts deploy application permission resource within HuaweiCloud. | ||
--- | ||
|
||
# huaweicloud_codearts_deploy_application_permission | ||
|
||
Manages a CodeArts deploy application permission resource within HuaweiCloud. | ||
|
||
-> Only when the applications using instance level permission, this resource is available. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "project_id" {} | ||
variable "application_ids" {} | ||
variable "role_id" {} | ||
resource "huaweicloud_codearts_deploy_group_permission" "test" { | ||
project_id = var.project_id | ||
application_ids = var.application_ids | ||
roles { | ||
role_id = var.role_id | ||
can_modify = true | ||
can_disable = true | ||
can_delete = true | ||
can_view = true | ||
can_execute = true | ||
can_copy = true | ||
can_manage = true | ||
can_create_env = true | ||
} | ||
} | ||
``` | ||
|
||
## 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 for CodeArts service. | ||
Changing this creates a new resource. | ||
|
||
* `application_ids` - (Required, List) Specifies the application IDs. | ||
|
||
* `roles` - (Required, List) Specifies the role permissions list. | ||
The [roles](#block--roles) structure is documented below. | ||
|
||
<a name="block--roles"></a> | ||
The `roles` block supports: | ||
|
||
* `role_id` - (Required, String) Specifies the role ID. | ||
|
||
* `can_copy` - (Required, Bool) Specifies whether the role has the copy permission. | ||
|
||
* `can_create_env` - (Required, Bool) Specifies whether the role has the permission to create an environment. | ||
|
||
* `can_delete` - (Required, Bool) Specifies whether the role has the deletion permission. | ||
|
||
* `can_disable` - (Required, Bool) Specifies whether the role has the permission to disable application. | ||
|
||
* `can_execute` - (Required, Bool) Specifies whether the role has the deployment permission. | ||
|
||
* `can_manage` - (Required, Bool) Specifies whether the role has the management permission, including adding, deleting, | ||
modifying, querying deployment and permission modification. | ||
|
||
* `can_modify` - (Required, Bool) Specifies whether the role has the editing permission. | ||
|
||
* `can_view` - (Required, Bool) Specifies whether the role has the view permission. | ||
|
||
## 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
49 changes: 49 additions & 0 deletions
49
...ptance/codeartsdeploy/resource_huaweicloud_codearts_deploy_application_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,49 @@ | ||
package codeartsdeploy | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" | ||
) | ||
|
||
func TestAccDeployApplicationPermissionModify_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: testAccDeployApplicationPermissionModify_basic(rName, false), | ||
}, | ||
{ | ||
Config: testAccDeployApplicationPermissionModify_basic(rName, true), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDeployApplicationPermissionModify_basic(rName string, value bool) string { | ||
return fmt.Sprintf(` | ||
%s | ||
resource "huaweicloud_codearts_deploy_application_permission" "test" { | ||
project_id = huaweicloud_codearts_deploy_application.test.project_id | ||
application_ids = [huaweicloud_codearts_deploy_application.test.id] | ||
roles { | ||
role_id = try(huaweicloud_codearts_deploy_application.test.permission_matrix[2].role_id, "") | ||
can_modify = %t | ||
can_disable = true | ||
can_delete = true | ||
can_view = true | ||
can_execute = true | ||
can_copy = true | ||
can_manage = true | ||
can_create_env = true | ||
} | ||
}`, testDeployApplication_basic(rName), value) | ||
} |
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.