Skip to content

Commit

Permalink
Merge branch 'main' into feature/upgrade-go-to-1-22
Browse files Browse the repository at this point in the history
  • Loading branch information
bertekintw authored Feb 22, 2024
2 parents 46068ee + 68db402 commit ca05384
Show file tree
Hide file tree
Showing 58 changed files with 2,660 additions and 281 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
branches:
- main


# Ensures only 1 action runs per PR and previous is canceled on new trigger
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
17 changes: 15 additions & 2 deletions docs/data-sources/connectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,31 @@ Connectors provide connectivity to Remote Networks. For more information, see Tw
## Example Usage

```terraform
data "twingate_connectors" "all" {}
data "twingate_connectors" "all" {
name = "<your connector's name>"
# name_regexp = "<regular expression of connector name>"
# name_contains = "<a string in the connector name>"
# name_exclude = "<your connector's name to exclude>"
# name_prefix = "<prefix of connector name>"
# name_suffix = "<suffix of connector name>"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `connectors` (Attributes List) List of Connectors (see [below for nested schema](#nestedatt--connectors))
- `name` (String) Returns only connectors that exactly match this name. If no options are passed it will return all connectors. Only one option can be used at a time.
- `name_contains` (String) Match when the value exist in the name of the connector.
- `name_exclude` (String) Match when the value does not exist in the name of the connector.
- `name_prefix` (String) The name of the connector must start with the value.
- `name_regexp` (String) The regular expression match of the name of the connector.
- `name_suffix` (String) The name of the connector must end with the value.

### Read-Only

- `connectors` (Attributes List) List of Connectors (see [below for nested schema](#nestedatt--connectors))
- `id` (String) The ID of this resource.

<a id="nestedatt--connectors"></a>
Expand Down
16 changes: 13 additions & 3 deletions docs/data-sources/groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Groups are how users are authorized to access Resources. For more information, s
```terraform
data "twingate_groups" "foo" {
name = "<your group's name>"
# name_regexp = "<regular expression of group name>"
# name_contains = "<a string in the group name>"
# name_exclude = "<your group's name to exclude>"
# name_prefix = "<prefix of resource name>"
# name_suffix = "<suffix of resource name>"
}
# Group names are not constrained to be unique within Twingate,
Expand All @@ -26,13 +31,18 @@ data "twingate_groups" "foo" {

### Optional

- `groups` (Attributes List) List of Groups (see [below for nested schema](#nestedatt--groups))
- `is_active` (Boolean) Returns only Groups matching the specified state.
- `name` (String) Returns only Groups that exactly match this name.
- `type` (String) Returns only Groups of the specified type (valid: `MANUAL`, `SYNCED`, `SYSTEM`).
- `name` (String) Returns only groups that exactly match this name. If no options are passed it will return all resources. Only one option can be used at a time.
- `name_contains` (String) Match when the value exist in the name of the group.
- `name_exclude` (String) Match when the value does not exist in the name of the group.
- `name_prefix` (String) The name of the group must start with the value.
- `name_regexp` (String) The regular expression match of the name of the group.
- `name_suffix` (String) The name of the group must end with the value.
- `types` (Set of String) Returns groups that match a list of types. valid types: `MANUAL`, `SYNCED`, `SYSTEM`.

### Read-Only

- `groups` (Attributes List) List of Groups (see [below for nested schema](#nestedatt--groups))
- `id` (String) The ID of this resource.

<a id="nestedatt--groups"></a>
Expand Down
23 changes: 21 additions & 2 deletions docs/data-sources/remote_networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,28 @@ A Remote Network represents a single private network in Twingate that can have o
## Example Usage

```terraform
data "twingate_remote_networks" "all" {}
data "twingate_remote_networks" "all" {
name = "<your network's name>"
# name_regexp = "<regular expression of network name>"
# name_contains = "<a string in the network name>"
# name_exclude = "<your network's name to exclude>"
# name_prefix = "<prefix of network name>"
# name_suffix = "<suffix of network name>"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `name` (String) Returns only remote networks that exactly match this name. If no options are passed it will return all remote networks. Only one option can be used at a time.
- `name_contains` (String) Match when the value exist in the name of the remote network.
- `name_exclude` (String) Match when the value does not exist in the name of the remote network.
- `name_prefix` (String) The name of the remote network must start with the value.
- `name_regexp` (String) The regular expression match of the name of the remote network.
- `name_suffix` (String) The name of the remote network must end with the value.

### Read-Only

- `id` (String) The ID of this resource.
Expand All @@ -27,8 +43,11 @@ data "twingate_remote_networks" "all" {}
<a id="nestedatt--remote_networks"></a>
### Nested Schema for `remote_networks`

Optional:

- `name` (String) The name of the Remote Network.

Read-Only:

- `id` (String) The ID of the Remote Network.
- `location` (String) The location of the Remote Network. Must be one of the following: AWS, AZURE, GOOGLE_CLOUD, ON_PREMISE, OTHER.
- `name` (String) The name of the Remote Network
14 changes: 12 additions & 2 deletions docs/data-sources/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Resources in Twingate represent servers on the private network that clients can
```terraform
data "twingate_resources" "foo" {
name = "<your resource's name>"
# name_regexp = "<regular expression of resource name>"
# name_contains = "<a string in the resource name>"
# name_exclude = "<your resource's name to exclude>"
# name_prefix = "<prefix of resource name>"
# name_suffix = "<suffix of resource name>"
}
# Resource names are not constrained to be unique within Twingate,
Expand All @@ -24,9 +29,14 @@ data "twingate_resources" "foo" {
<!-- schema generated by tfplugindocs -->
## Schema

### Required
### Optional

- `name` (String) The name of the Resource
- `name` (String) Returns only resources that exactly match this name. If no options are passed it will return all resources. Only one option can be used at a time.
- `name_contains` (String) Match when the value exist in the name of the resource.
- `name_exclude` (String) Match when the value does not exist in the name of the resource.
- `name_prefix` (String) The name of the resource must start with the value.
- `name_regexp` (String) The regular expression match of the name of the resource.
- `name_suffix` (String) The name of the resource must end with the value.

### Read-Only

Expand Down
17 changes: 15 additions & 2 deletions docs/data-sources/security_policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,32 @@ Security Policies are defined in the Twingate Admin Console and determine user a
## Example Usage

```terraform
data "twingate_security_policies" "all" {}
data "twingate_security_policies" "all" {
name = "<your security policy's name>"
# name_regexp = "<regular expression of security policy name>"
# name_contains = "<a string in the security policy name>"
# name_exclude = "<your security policy's name to exclude>"
# name_prefix = "<prefix of security policy name>"
# name_suffix = "<suffix of security policy name>"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `security_policies` (Attributes List) (see [below for nested schema](#nestedatt--security_policies))
- `name` (String) Returns only security policies that exactly match this name. If no options are passed it will return all security policies. Only one option can be used at a time.
- `name_contains` (String) Match when the value exist in the name of the security policy.
- `name_exclude` (String) Match when the value does not exist in the name of the security policy.
- `name_prefix` (String) The name of the security policy must start with the value.
- `name_regexp` (String) The regular expression match of the name of the security policy.
- `name_suffix` (String) The name of the security policy must end with the value.

### Read-Only

- `id` (String) The ID of this resource.
- `security_policies` (Attributes List) (see [below for nested schema](#nestedatt--security_policies))

<a id="nestedatt--security_policies"></a>
### Nested Schema for `security_policies`
Expand Down
12 changes: 11 additions & 1 deletion docs/data-sources/service_accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Service Accounts offer a way to provide programmatic, centrally-controlled, and
```terraform
data "twingate_service_accounts" "foo" {
name = "<your service account's name>"
# name_regexp = "<regular expression of service account name>"
# name_contains = "<a string in the service account name>"
# name_exclude = "<your service account's name to exclude>"
# name_prefix = "<prefix of service account name>"
# name_suffix = "<suffix of service account name>"
}
```

Expand All @@ -23,7 +28,12 @@ data "twingate_service_accounts" "foo" {

### Optional

- `name` (String) Filter results by the name of the Service Account.
- `name` (String) Returns only service accounts that exactly match this name. If no options are passed it will return all service accounts. Only one option can be used at a time.
- `name_contains` (String) Match when the value exist in the name of the service account.
- `name_exclude` (String) Match when the value does not exist in the name of the service account.
- `name_prefix` (String) The name of the service account must start with the value.
- `name_regexp` (String) The regular expression match of the name of the service account.
- `name_suffix` (String) The name of the service account must end with the value.

### Read-Only

Expand Down
47 changes: 46 additions & 1 deletion docs/data-sources/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,57 @@ Users in Twingate can be given access to Twingate Resources and may either be ad
## Example Usage

```terraform
data "twingate_users" "all" {}
data "twingate_users" "all" {
# email = "<your user's email>"
# email_regexp = "<regular expression of user email>"
# email_contains = "<a string in the user email>"
# email_exclude = "<your user's email to exclude>"
# email_prefix = "<prefix of user email>"
# email_suffix = "<suffix of user email>"
# first_name = "<your user's first name>"
# first_name_regexp = "<regular expression of user first name>"
# first_name_contains = "<a string in the user first name>"
# first_name_exclude = "<your user's first name to exclude>"
# first_name_prefix = "<prefix of user first name>"
# first_name_suffix = "<suffix of user first name>"
# last_name = "<your user's last name>"
# last_name_regexp = "<regular expression of user last name>"
# last_name_contains = "<a string in the user last name>"
# last_name_exclude = "<your user's last name to exclude>"
# last_name_prefix = "<prefix of user last name>"
# last_name_suffix = "<suffix of user last name>"
# roles = ["ADMIN", "DEVOPS", "SUPPORT", "MEMBER"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `email` (String) Returns only users that exactly match this email.
- `email_contains` (String) Match when the value exist in the email of the user.
- `email_exclude` (String) Match when the value does not exist in the email of the user.
- `email_prefix` (String) The email of the user must start with the value.
- `email_regexp` (String) The regular expression match of the email of the user.
- `email_suffix` (String) The email of the user must end with the value.
- `first_name` (String) Returns only users that exactly match the first name.
- `first_name_contains` (String) Match when the value exist in the first name of the user.
- `first_name_exclude` (String) Match when the value does not exist in the first name of the user.
- `first_name_prefix` (String) The first name of the user must start with the value.
- `first_name_regexp` (String) The regular expression match of the first name of the user.
- `first_name_suffix` (String) The first name of the user must end with the value.
- `last_name` (String) Returns only users that exactly match the last name.
- `last_name_contains` (String) Match when the value exist in the last name of the user.
- `last_name_exclude` (String) Match when the value does not exist in the last name of the user.
- `last_name_prefix` (String) The last name of the user must start with the value.
- `last_name_regexp` (String) The regular expression match of the last name of the user.
- `last_name_suffix` (String) The last name of the user must end with the value.
- `roles` (Set of String) Returns users that match a list of roles. Valid roles: `ADMIN`, `DEVOPS`, `SUPPORT`, `MEMBER`.

### Read-Only

- `id` (String) The ID of this resource.
Expand Down
9 changes: 8 additions & 1 deletion examples/data-sources/twingate_connectors/data-source.tf
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
data "twingate_connectors" "all" {}
data "twingate_connectors" "all" {
name = "<your connector's name>"
# name_regexp = "<regular expression of connector name>"
# name_contains = "<a string in the connector name>"
# name_exclude = "<your connector's name to exclude>"
# name_prefix = "<prefix of connector name>"
# name_suffix = "<suffix of connector name>"
}
5 changes: 5 additions & 0 deletions examples/data-sources/twingate_groups/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
data "twingate_groups" "foo" {
name = "<your group's name>"
# name_regexp = "<regular expression of group name>"
# name_contains = "<a string in the group name>"
# name_exclude = "<your group's name to exclude>"
# name_prefix = "<prefix of resource name>"
# name_suffix = "<suffix of resource name>"
}

# Group names are not constrained to be unique within Twingate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
data "twingate_remote_networks" "all" {}
data "twingate_remote_networks" "all" {
name = "<your network's name>"
# name_regexp = "<regular expression of network name>"
# name_contains = "<a string in the network name>"
# name_exclude = "<your network's name to exclude>"
# name_prefix = "<prefix of network name>"
# name_suffix = "<suffix of network name>"
}
5 changes: 5 additions & 0 deletions examples/data-sources/twingate_resources/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
data "twingate_resources" "foo" {
name = "<your resource's name>"
# name_regexp = "<regular expression of resource name>"
# name_contains = "<a string in the resource name>"
# name_exclude = "<your resource's name to exclude>"
# name_prefix = "<prefix of resource name>"
# name_suffix = "<suffix of resource name>"
}

# Resource names are not constrained to be unique within Twingate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
data "twingate_security_policies" "all" {}
data "twingate_security_policies" "all" {
name = "<your security policy's name>"
# name_regexp = "<regular expression of security policy name>"
# name_contains = "<a string in the security policy name>"
# name_exclude = "<your security policy's name to exclude>"
# name_prefix = "<prefix of security policy name>"
# name_suffix = "<suffix of security policy name>"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "twingate_service_accounts" "foo" {
name = "<your service account's name>"
# name_regexp = "<regular expression of service account name>"
# name_contains = "<a string in the service account name>"
# name_exclude = "<your service account's name to exclude>"
# name_prefix = "<prefix of service account name>"
# name_suffix = "<suffix of service account name>"
}
25 changes: 24 additions & 1 deletion examples/data-sources/twingate_users/data-source.tf
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
data "twingate_users" "all" {}
data "twingate_users" "all" {
# email = "<your user's email>"
# email_regexp = "<regular expression of user email>"
# email_contains = "<a string in the user email>"
# email_exclude = "<your user's email to exclude>"
# email_prefix = "<prefix of user email>"
# email_suffix = "<suffix of user email>"

# first_name = "<your user's first name>"
# first_name_regexp = "<regular expression of user first name>"
# first_name_contains = "<a string in the user first name>"
# first_name_exclude = "<your user's first name to exclude>"
# first_name_prefix = "<prefix of user first name>"
# first_name_suffix = "<suffix of user first name>"

# last_name = "<your user's last name>"
# last_name_regexp = "<regular expression of user last name>"
# last_name_contains = "<a string in the user last name>"
# last_name_exclude = "<your user's last name to exclude>"
# last_name_prefix = "<prefix of user last name>"
# last_name_suffix = "<suffix of user last name>"

# roles = ["ADMIN", "DEVOPS", "SUPPORT", "MEMBER"]
}
6 changes: 6 additions & 0 deletions twingate/internal/attr/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ const (
RemoteNetworkID = "remote_network_id"
Type = "type"
IsActive = "is_active"

FilterByRegexp = "_regexp"
FilterByContains = "_contains"
FilterByExclude = "_exclude"
FilterByPrefix = "_prefix"
FilterBySuffix = "_suffix"
)
1 change: 1 addition & 0 deletions twingate/internal/attr/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ const (
SecurityPolicyID = "security_policy_id"
Groups = "groups"
Alias = "alias"
Types = "types"
)
1 change: 1 addition & 0 deletions twingate/internal/attr/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const (
LastName = "last_name"
Email = "email"
Role = "role"
Roles = "roles"
Users = "users"
SendInvite = "send_invite"
State = "state"
Expand Down
3 changes: 2 additions & 1 deletion twingate/internal/client/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ func (client *Client) ReadConnector(ctx context.Context, connectorID string) (*m
return response.ToModel(), nil
}

func (client *Client) ReadConnectors(ctx context.Context) ([]*model.Connector, error) {
func (client *Client) ReadConnectors(ctx context.Context, name, filter string) ([]*model.Connector, error) {
opr := resourceConnector.read()

variables := newVars(
gqlNullable(query.NewConnectorFilterInput(name, filter), "filter"),
cursor(query.CursorConnectors),
pageLimit(client.pageLimit),
)
Expand Down
Loading

0 comments on commit ca05384

Please sign in to comment.