Skip to content

Commit

Permalink
Mark Guild Role position as computed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyb3r-Jak3 committed Oct 24, 2024
1 parent 6b4569d commit 51a114b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions discord/resource_discord_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ func resourceDiscordRole() *schema.Resource {
"position": {
Type: schema.TypeInt,
Optional: true,
Default: 1,
Computed: true,
ForceNew: false,
ValidateFunc: validation.IntAtLeast(1),
Description: "The position of the role. This is reverse indexed, with `@everyone` being `0`.",
Description: "Position of the role. This is reverse indexed, with `@everyone` being `0`.",
},
"managed": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -132,6 +132,8 @@ func resourceRoleCreate(ctx context.Context, d *schema.ResourceData, m interface
} else {
d.Set("position", newPosition)
}
} else {
d.Set("position", role.Position)
}

d.SetId(role.ID)
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resource "discord_role" "moderator" {
- `hoist` (Boolean) Whether the role should be hoisted. (default `false`)
- `mentionable` (Boolean) Whether the role should be mentionable. (default `false`)
- `permissions` (Number) The permission bits of the role.
- `position` (Number) The position of the role. This is reverse indexed, with `@everyone` being `0`.
- `position` (Number) Position of the role. This is reverse indexed, with `@everyone` being `0`.

### Read-Only

Expand Down

0 comments on commit 51a114b

Please sign in to comment.