Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added connection_status field support in user datasource #37

Merged
merged 2 commits into from
Jul 31, 2024
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
6 changes: 6 additions & 0 deletions cloudconnexa/data_source_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func dataSourceUser() *schema.Resource {
Computed: true,
Description: "The user's status.",
},
"connection_status": {
Type: schema.TypeString,
Computed: true,
Description: "The user's connection status.",
},
"devices": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -118,6 +123,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, m interface
d.Set("group_id", user.GroupId)
d.Set("status", user.Status)
d.Set("devices", getUserDevicesSlice(&user.Devices))
d.Set("connection_status", user.ConnectionStatus)
return diags
}

Expand Down
4 changes: 4 additions & 0 deletions docs/data-sources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Use a `cloudconnexa_user` data source to read a specific CloudConnexa user.


<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand All @@ -31,8 +32,11 @@ Use a `cloudconnexa_user` data source to read a specific CloudConnexa user.
- `last_name` (String) The user's last name.
- `status` (String) The user's status.
- `user_id` (String) The ID of this resource.
- `connection_status` (String) The user's connection status. Valid values are `OFFLINE`, `ONLINE`,
or `ONLINE_WITH_ISSUES`.

<a id="nestedatt--devices"></a>

### Nested Schema for `devices`

Read-Only:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/gruntwork-io/terratest v0.46.1
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/openvpn/cloudconnexa-go-client/v2 v2.0.11
github.com/openvpn/cloudconnexa-go-client/v2 v2.0.12
github.com/stretchr/testify v1.9.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
github.com/openvpn/cloudconnexa-go-client/v2 v2.0.11 h1:NZ5cdmKhhjIYRbmyHXvRsCUTOI4tOtPlBaXpO/PgSnI=
github.com/openvpn/cloudconnexa-go-client/v2 v2.0.11/go.mod h1:udq5IDkgXvMO6mQUEFsLHzEyGGAduhO0jJvlb9f4JkE=
github.com/openvpn/cloudconnexa-go-client/v2 v2.0.12 h1:qUgOw8ppxtUj741XqfVCbtSNHBM81J6cEQkr3hgs9Jg=
github.com/openvpn/cloudconnexa-go-client/v2 v2.0.12/go.mod h1:udq5IDkgXvMO6mQUEFsLHzEyGGAduhO0jJvlb9f4JkE=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down