Skip to content

Commit

Permalink
chore: migrate to framework
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad committed Oct 27, 2024
1 parent 667012b commit 936292c
Show file tree
Hide file tree
Showing 23 changed files with 1,502 additions and 1,035 deletions.
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CONTAINER_NETWORK ?= $(shell \
; fi)

.PHONY: test
default: test
default: test doc

# Start host containers used for playground and testing
hosts: clean
Expand All @@ -32,7 +32,7 @@ ifeq ($(DEVCONTAINER),true)
else
$(CONTAINER_RUNTIME) run --rm --net remote -v ~/go:/go:z -v $(PWD):/provider:z --workdir /provider \
-e "TF_LOG=INFO" -e "TF_ACC=1" -e "TF_ACC_TERRAFORM_VERSION=1.0.11" -e "TESTARGS=$(TESTARGS)" \
golang:1.22 bash tests/test.sh
docker.io/golang:1.22 bash tests/test.sh
endif

# Install provider in playground
Expand All @@ -45,4 +45,4 @@ install:
go build -ldflags="-s -w -X main.version=99.0.0" -o $(BIN_PATH)

doc:
go generate
cd tools && go generate
11 changes: 5 additions & 6 deletions docs/data-sources/file.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "remote_file Data Source - terraform-provider-remote"
page_title: "remote_file Data Source - remote"
subcategory: ""
description: |-
File on remote host.
Expand Down Expand Up @@ -46,14 +46,13 @@ data "remote_file" "server2_hosts" {

### Optional

- `conn` (Block List, Max: 1) Connection to host where files are located. (see [below for nested schema](#nestedblock--conn))
- `conn` (Block, Optional) Connection to host where files are located. (see [below for nested schema](#nestedblock--conn))

### Read-Only

- `content` (String) Content of file.
- `group` (String) Group ID (GID) of file owner.
- `group_name` (String) Group name of file owner.
- `id` (String) The ID of this resource.
- `owner` (String) User ID (UID) of file owner.
- `owner_name` (String) User name of file owner.
- `permissions` (String) Permissions of file (in octal form).
Expand All @@ -68,11 +67,11 @@ Required:

Optional:

- `agent` (Boolean) Use a local SSH agent to login to the remote host. Defaults to `false`.
- `agent` (Boolean) Use a local SSH agent to login to the remote host.
- `password` (String, Sensitive) The pasword for the user on the remote host.
- `port` (Number) The ssh port on the remote host. Defaults to `22`.
- `port` (Number) The ssh port on the remote host.
- `private_key` (String, Sensitive) The private key used to login to the remote host.
- `private_key_env_var` (String) The name of the local environment variable containing the private key used to login to the remote host.
- `private_key_path` (String) The local path to the private key used to login to the remote host.
- `sudo` (Boolean) Use sudo to gain access to file. Defaults to `false`.
- `sudo` (Boolean) Use sudo to gain access to file.
- `timeout` (Number) The maximum amount of time, in milliseconds, for the TCP connection to establish. Timeout of zero means no timeout.
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ provider "remote" {

### Optional

- `conn` (Block List, Max: 1) Default connection to host where files are located. Can be overridden in resources and data sources. (see [below for nested schema](#nestedblock--conn))
- `max_sessions` (Number) Maximum number of open sessions in each host connection. Defaults to `3`.
- `conn` (Block, Optional) Default connection to host where files are located. Can be overridden in resources and data sources. (see [below for nested schema](#nestedblock--conn))
- `max_sessions` (Number) Maximum number of open sessions in each host connection.

<a id="nestedblock--conn"></a>
### Nested Schema for `conn`
Expand All @@ -65,11 +65,11 @@ Required:

Optional:

- `agent` (Boolean) Use a local SSH agent to login to the remote host. Defaults to `false`.
- `agent` (Boolean) Use a local SSH agent to login to the remote host.
- `password` (String, Sensitive) The pasword for the user on the remote host.
- `port` (Number) The ssh port on the remote host. Defaults to `22`.
- `port` (Number) The ssh port on the remote host.
- `private_key` (String, Sensitive) The private key used to login to the remote host.
- `private_key_env_var` (String) The name of the local environment variable containing the private key used to login to the remote host.
- `private_key_path` (String) The local path to the private key used to login to the remote host.
- `sudo` (Boolean) Use sudo to gain access to file. Defaults to `false`.
- `sudo` (Boolean) Use sudo to gain access to file.
- `timeout` (Number) The maximum amount of time, in milliseconds, for the TCP connection to establish. Timeout of zero means no timeout.
16 changes: 6 additions & 10 deletions docs/resources/file.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "remote_file Resource - terraform-provider-remote"
page_title: "remote_file Resource - remote"
subcategory: ""
description: |-
File on remote host.
Expand Down Expand Up @@ -57,16 +57,12 @@ resource "remote_file" "server2_bashrc" {

### Optional

- `conn` (Block List, Max: 1) Connection to host where files are located. (see [below for nested schema](#nestedblock--conn))
- `conn` (Block, Optional) Connection to host where files are located. (see [below for nested schema](#nestedblock--conn))
- `group` (String) Group ID (GID) of file owner. Mutually exclusive with `group_name`.
- `group_name` (String) Group name of file owner. Mutually exclusive with `group`.
- `owner` (String) User ID (UID) of file owner. Mutually exclusive with `owner_name`.
- `owner_name` (String) User name of file owner. Mutually exclusive with `owner`.
- `permissions` (String) Permissions of file (in octal form). Defaults to `0644`.

### Read-Only

- `id` (String) The ID of this resource.
- `permissions` (String) Permissions of file (in octal form).

<a id="nestedblock--conn"></a>
### Nested Schema for `conn`
Expand All @@ -78,11 +74,11 @@ Required:

Optional:

- `agent` (Boolean) Use a local SSH agent to login to the remote host. Defaults to `false`.
- `agent` (Boolean) Use a local SSH agent to login to the remote host.
- `password` (String, Sensitive) The pasword for the user on the remote host.
- `port` (Number) The ssh port on the remote host. Defaults to `22`.
- `port` (Number) The ssh port on the remote host.
- `private_key` (String, Sensitive) The private key used to login to the remote host.
- `private_key_env_var` (String) The name of the local environment variable containing the private key used to login to the remote host.
- `private_key_path` (String) The local path to the private key used to login to the remote host.
- `sudo` (Boolean) Use sudo to gain access to file. Defaults to `false`.
- `sudo` (Boolean) Use sudo to gain access to file.
- `timeout` (Number) The maximum amount of time, in milliseconds, for the TCP connection to establish. Timeout of zero means no timeout.
61 changes: 25 additions & 36 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,85 +1,74 @@
module github.com/tenstad/terraform-provider-remote

go 1.22
go 1.22.7

toolchain go1.23.1

require (
github.com/bramvdbogaerde/go-scp v1.5.0
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/pkg/sftp v1.13.6
golang.org/x/crypto v0.28.0
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/stretchr/testify v1.8.2 // indirect
)

require (
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hc-install v0.7.0 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/hc-install v0.8.0 // indirect
github.com/hashicorp/hcl/v2 v2.21.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.22.1 // indirect
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
github.com/hashicorp/terraform-plugin-framework v1.12.0
github.com/hashicorp/terraform-plugin-framework-validators v0.14.0
github.com/hashicorp/terraform-plugin-go v0.24.0
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/hashicorp/terraform-plugin-testing v1.10.0
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/goldmark v1.7.1 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/grpc v1.66.2 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)
Loading

0 comments on commit 936292c

Please sign in to comment.