Skip to content

Commit ec48e60

Browse files
Add global setting to group (#95)
1 parent 5c24f49 commit ec48e60

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

example/user/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
plural = {
44
source = "pluralsh/plural"
5-
version = "0.2.1"
5+
version = "0.2.25"
66
}
77
}
88
}
@@ -24,11 +24,13 @@ resource "plural_user" "spiderman" {
2424

2525
# data "plural_group" "avengers" {
2626
# name = "avengers"
27+
# global = "false"
2728
# }
2829
#
2930
# resource "plural_group" "avengers" {
3031
# name = "avengers"
3132
# description = "avengers group"
33+
# global = "false"
3234
# }
3335
#
3436
# resource "plural_group_member" "spiderman" {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/hashicorp/terraform-plugin-framework-validators v0.17.0
1111
github.com/hashicorp/terraform-plugin-log v0.9.0
1212
github.com/mitchellh/go-homedir v1.1.0
13-
github.com/pluralsh/console/go/client v1.41.0
13+
github.com/pluralsh/console/go/client v1.46.2
1414
github.com/pluralsh/plural-cli v0.12.3
1515
github.com/pluralsh/polly v0.2.0
1616
github.com/samber/lo v1.50.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,8 @@ github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxu
651651
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
652652
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
653653
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
654-
github.com/pluralsh/console/go/client v1.41.0 h1:crSRnRx0wQ4TloFmq8Q/tUgv1sRLXiHmp+xbAFCQQlc=
655-
github.com/pluralsh/console/go/client v1.41.0/go.mod h1:8XlMMN3LLAN9JZo69f8X/XN7Qt1+aaKpgTvvQGfSiEU=
654+
github.com/pluralsh/console/go/client v1.46.2 h1:8LXBk32GChWpcfZKmZbyMILxzErdCkBhJqjpBqDlXxA=
655+
github.com/pluralsh/console/go/client v1.46.2/go.mod h1:8XlMMN3LLAN9JZo69f8X/XN7Qt1+aaKpgTvvQGfSiEU=
656656
github.com/pluralsh/gqlclient v1.12.2 h1:BrEFAASktf4quFw57CIaLAd+NZUTLhG08fe6tnhBQN4=
657657
github.com/pluralsh/gqlclient v1.12.2/go.mod h1:OEjN9L63x8m3A3eQBv5kVkFgiY9fp2aZ0cgOF0uII58=
658658
github.com/pluralsh/plural-cli v0.12.3 h1:hwu8yMZ8YBby+H3XSMLyJbV6XkIv6yrF6M2LfEa/dMA=

internal/datasource/group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func (d *groupDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
4343
MarkdownDescription: "Description of this group.",
4444
Computed: true,
4545
},
46+
"global": schema.BoolAttribute{
47+
Optional: true,
48+
},
4649
},
4750
}
4851
}

internal/model/group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ type Group struct {
99
Id types.String `tfsdk:"id"`
1010
Name types.String `tfsdk:"name"`
1111
Description types.String `tfsdk:"description"`
12+
Global types.Bool `tfsdk:"global"`
1213
}
1314

1415
func (g *Group) From(response *gqlclient.GroupFragment) {
1516
g.Id = types.StringValue(response.ID)
1617
g.Name = types.StringValue(response.Name)
1718
g.Description = types.StringPointerValue(response.Description)
19+
g.Global = types.BoolPointerValue(response.Global)
1820
}
1921

2022
func (g *Group) Attributes() gqlclient.GroupAttributes {
2123
return gqlclient.GroupAttributes{
2224
Name: g.Name.ValueString(),
2325
Description: g.Description.ValueStringPointer(),
26+
Global: g.Global.ValueBoolPointer(),
2427
}
2528
}

internal/resource/group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ func (r *GroupResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
5656
Description: "Description of this group.",
5757
MarkdownDescription: "Description of this group.",
5858
},
59+
"global": schema.BoolAttribute{
60+
Optional: true,
61+
},
5962
},
6063
}
6164
}

0 commit comments

Comments
 (0)