forked from Twingate/terraform-provider-twingate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: migrate Resource object to new TF SDK, breaking changes for …
…protocols section (Twingate#412) * convert resource object * added feature branch * Update go mod file * fix test * remove feature branch * breaking change: set IsBrowserShortcutEnabled=false by default * remove feature branch * added security_policy_id to resource definition * remove feature branch from CI * added feature branch to CI * remove feature branch * added schema upgrader * fix updating resource without protocols * fix setting default ports value * fix diff supress for empty ports array * fix default ports value * fix test TestAccTwingateResourceImport * fix test * restore ci.yml * docs update * added migration guide * update formatting * enable test on feature branch * revert ci changes * Update migration guide * removed is_admin from user(s) datasources * enable tests * fix fmt * drop terraform 1.3.* * remove feature branch * Fix typo in the guide --------- Co-authored-by: Alex Bertsch <[email protected]>
- Loading branch information
1 parent
5c7602f
commit af0c800
Showing
29 changed files
with
2,061 additions
and
1,134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,7 +124,8 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
terraform: | ||
- '1.3.*' | ||
- '1.4.*' | ||
- '1.5.*' | ||
- 'latest' | ||
steps: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
subcategory: "migration" | ||
page_title: "v1 to v2 Migration Guide" | ||
description: |- | ||
This document covers how to migrate from v1 to v2 of the Twingate Terraform provider. | ||
--- | ||
|
||
# Migration Guide | ||
j | ||
This guide covers how to migrate from v1 to v2 of the Twingate Terraform provider. Migration needs to be done for the following objects: | ||
- Resources | ||
- `twingate_resource` | ||
- Data sources | ||
- `twingate_user` | ||
- `twingate_users` | ||
|
||
## Migrating Resources | ||
|
||
The `protocols` attribute in the `twingate_resource` Resource has been changed from a block to an object. | ||
|
||
In v1, the following was valid: | ||
|
||
```terraform | ||
resource "twingate_resource" "resource" { | ||
name = "resource" | ||
address = "internal.int" | ||
remote_network_id = twingate_remote_network.aws_network.id | ||
protocols { | ||
allow_icmp = true | ||
tcp { | ||
policy = "RESTRICTED" | ||
ports = ["80", "82-83"] | ||
} | ||
udp { | ||
policy = "ALLOW_ALL" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The `protocols`, `tcp` and `udp` attributes were blocks and not objects. In v2, these are now objects: | ||
|
||
``` | ||
protocols { -> protocols = { | ||
tcp { -> tcp = { | ||
udp { -> udp = { | ||
``` | ||
|
||
In v2, the above resource needs to be rewritten like this: | ||
|
||
```terraform | ||
resource "twingate_resource" "resource" { | ||
name = "resource" | ||
address = "internal.int" | ||
remote_network_id = twingate_remote_network.aws_network.id | ||
protocols = { | ||
allow_icmp = true | ||
tcp = { | ||
policy = "RESTRICTED" | ||
ports = ["80", "82-83"] | ||
} | ||
udp = { | ||
policy = "ALLOW_ALL" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Migrating data sources | ||
|
||
The attribute `is_admin` has been removed from the `twingate_user` and `twingate_users` data sources. Similar information is now available via the [`role` attribute](https://registry.terraform.io/providers/Twingate/twingate/latest/docs/data-sources/users#role). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
subcategory: "migration" | ||
page_title: "v1 to v2 Migration Guide" | ||
description: |- | ||
This document covers how to migrate from v1 to v2 of the Twingate Terraform provider. | ||
--- | ||
|
||
# Migration Guide | ||
j | ||
This guide covers how to migrate from v1 to v2 of the Twingate Terraform provider. Migration needs to be done for the following objects: | ||
- Resources | ||
- `twingate_resource` | ||
- Data sources | ||
- `twingate_user` | ||
- `twingate_users` | ||
|
||
## Migrating Resources | ||
|
||
The `protocols` attribute in the `twingate_resource` Resource has been changed from a block to an object. | ||
|
||
In v1, the following was valid: | ||
|
||
```terraform | ||
resource "twingate_resource" "resource" { | ||
name = "resource" | ||
address = "internal.int" | ||
remote_network_id = twingate_remote_network.aws_network.id | ||
|
||
protocols { | ||
allow_icmp = true | ||
tcp { | ||
policy = "RESTRICTED" | ||
ports = ["80", "82-83"] | ||
} | ||
udp { | ||
policy = "ALLOW_ALL" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The `protocols`, `tcp` and `udp` attributes were blocks and not objects. In v2, these are now objects: | ||
|
||
``` | ||
protocols { -> protocols = { | ||
tcp { -> tcp = { | ||
udp { -> udp = { | ||
``` | ||
|
||
In v2, the above resource needs to be rewritten like this: | ||
|
||
```terraform | ||
resource "twingate_resource" "resource" { | ||
name = "resource" | ||
address = "internal.int" | ||
remote_network_id = twingate_remote_network.aws_network.id | ||
|
||
protocols = { | ||
allow_icmp = true | ||
tcp = { | ||
policy = "RESTRICTED" | ||
ports = ["80", "82-83"] | ||
} | ||
udp = { | ||
policy = "ALLOW_ALL" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Migrating data sources | ||
|
||
The attribute `is_admin` has been removed from the `twingate_user` and `twingate_users` data sources. Similar information is now available via the [`role` attribute](https://registry.terraform.io/providers/Twingate/twingate/latest/docs/data-sources/users#role). |
Oops, something went wrong.