Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions examples/setup/environment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ resource "bytebase_policy" "rollout_policy" {
automatic = true
roles = [
"roles/workspaceAdmin",
"roles/projectOwner",
"roles/LAST_APPROVER",
"roles/CREATOR"
"roles/projectOwner"
]
}
}
Expand Down
9 changes: 1 addition & 8 deletions provider/data_source_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,6 @@ func getDataSourceQueryPolicySchema(computed bool) *schema.Schema {
}
}

const (
issueLastApproverRole = "roles/LAST_APPROVER"
issueCreatorRole = "roles/CREATOR"
)

func getRolloutPolicySchema(computed bool) *schema.Schema {
return &schema.Schema{
Computed: computed,
Expand All @@ -348,10 +343,8 @@ func getRolloutPolicySchema(computed bool) *schema.Schema {
Description: "If any roles are specified, Bytebase requires users with those roles to manually roll out the change.",
Elem: &schema.Schema{
Type: schema.TypeString,
Description: fmt.Sprintf(`Role full name in roles/{id} format. You can also use the "%s" for the last approver of the issue, or "%s" for the creator of the issue.`, issueLastApproverRole, issueCreatorRole),
Description: `Role full name in roles/{id} format.`,
ValidateDiagFunc: internal.ResourceNameValidation(
fmt.Sprintf("^%s$", issueLastApproverRole),
fmt.Sprintf("^%s$", issueCreatorRole),
fmt.Sprintf("^%s", internal.RoleNamePrefix),
),
},
Expand Down
6 changes: 1 addition & 5 deletions provider/resource_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,7 @@ func convertToRolloutPolicy(d *schema.ResourceData) (*v1pb.RolloutPolicy, error)

for _, rawRole := range roles.List() {
role := rawRole.(string)
if role == issueLastApproverRole || role == issueCreatorRole {
policy.IssueRoles = append(policy.IssueRoles, role)
} else {
policy.Roles = append(policy.Roles, role)
}
policy.Roles = append(policy.Roles, role)
}

return policy, nil
Expand Down
8 changes: 2 additions & 6 deletions tutorials/1-2-env-policy-rollout.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ resource "bytebase_policy" "rollout_policy_test" {
automatic = true
roles = [
"roles/workspaceAdmin",
"roles/projectOwner",
"roles/LAST_APPROVER",
"roles/CREATOR"
"roles/projectOwner"
]
}
}
Expand All @@ -23,9 +21,7 @@ resource "bytebase_policy" "rollout_policy_prod" {
automatic = false
roles = [
"roles/workspaceAdmin",
"roles/projectOwner",
"roles/LAST_APPROVER",
"roles/CREATOR"
"roles/projectOwner"
]
}
}