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 terraform v0.14 support #17

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
454038b
Proof-of-concept for Terraform v0.12 support.
stefansundin Aug 21, 2019
02c00a6
added go-plugin
AndrewChubatiuk Mar 4, 2021
88ce3a3
updated makefile
AndrewChubatiuk Mar 4, 2021
0f5ce26
added ssh_tunnel_close data source to keep connection opened
AndrewChubatiuk Mar 6, 2021
cf8dfef
removed unused modules
AndrewChubatiuk Mar 6, 2021
2d038a9
updated data source structure
AndrewChubatiuk Mar 6, 2021
748abd4
close connection with context
AndrewChubatiuk Mar 6, 2021
9adc8ab
added website
AndrewChubatiuk Mar 6, 2021
0967763
close ssh tunnel
AndrewChubatiuk Mar 6, 2021
9c6f6fa
updated data source structure
AndrewChubatiuk Mar 7, 2021
f74c222
added sockets support
AndrewChubatiuk Mar 7, 2021
2ab0d48
close local ssh connections
AndrewChubatiuk Mar 7, 2021
32f46f1
fixed website docs
AndrewChubatiuk Mar 7, 2021
41a7bbe
added github actions
AndrewChubatiuk Apr 30, 2021
df8e263
Merge pull request #1 from AndrewChubatiuk/v0.14
AndrewChubatiuk Apr 30, 2021
1f7ac9b
upgraded go version
AndrewChubatiuk Apr 30, 2021
37c4198
updated website
AndrewChubatiuk May 7, 2021
aef79af
spawn ssh tunnel as a separate process
AndrewChubatiuk Dec 20, 2021
ad8de82
added rpc communication for ssh tunnel process
AndrewChubatiuk Dec 22, 2021
55c474a
removed close tunnel ds
AndrewChubatiuk Dec 22, 2021
73b524d
removed tunnel close data source
AndrewChubatiuk Dec 22, 2021
a8fdf66
added timeout
AndrewChubatiuk Dec 22, 2021
47dc0fc
added tunnel stdout to provider
AndrewChubatiuk Dec 23, 2021
a13c624
fixed link
AndrewChubatiuk Dec 23, 2021
fd1b05c
Merge pull request #2 from AndrewChubatiuk/spawn-process-for-ssh-tunnel
AndrewChubatiuk Dec 23, 2021
52f2c49
updated error message
AndrewChubatiuk Dec 25, 2021
c85efb0
added windows support
Apr 19, 2022
b63026b
Merge pull request #4 from AndrewChubatiuk/windows-support
AndrewChubatiuk Apr 19, 2022
3fc82cf
fixed password auth
Apr 20, 2022
cbe5da8
updated parent pid check for tunnel process
Apr 20, 2022
74ac509
Merge pull request #6 from AndrewChubatiuk/windows-support
AndrewChubatiuk Apr 20, 2022
070960a
use parent stdout and stderr for tunnel
May 2, 2023
27ffba2
updated actions
May 2, 2023
504076c
updated actions
May 2, 2023
1e4b73b
updated actions
May 2, 2023
7d79ffd
updated actions
May 2, 2023
bd6f3dc
updated actions
May 2, 2023
5e0c792
upgraded provider framework
May 4, 2023
368e04b
added ability to run multiple instances
May 4, 2023
0bfcb7f
fixed docs
May 4, 2023
50eb9a2
fixed docs
May 4, 2023
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
5 changes: 5 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code of Conduct

HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code.

Please read the full text at https://www.hashicorp.com/community-guidelines
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

### Terraform Version
Run `terraform -v` to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

### Affected Resource(s)
Please list the resources as a list, for example:
- opc_instance
- opc_storage_volume

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

### Terraform Configuration Files
```hcl
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
```

### Debug Output
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

### Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`.

### Expected Behavior
What should have happened?

### Actual Behavior
What actually happened?

### Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
1. `terraform apply`

### Important Factoids
Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

### References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
- GH-1234
5 changes: 5 additions & 0 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Support

Terraform is a mature project with a growing community. There are active, dedicated people willing to help you through various mediums.

Take a look at those mediums listed at https://www.terraform.io/community.html
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20'
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ terraform.d
*.tfstate
*.tfstate.backup
*.tfplan
terraform-open-ssh-tunnels/terraform-open-ssh-tunnels
terraform-open-ssh-tunnels/terraform-open-ssh-tunnels.exe
/terraform-open-ssh-tunnels_*
*.pb.go
/release
/vendor
55 changes: 55 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
- go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this is a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
59 changes: 0 additions & 59 deletions Makefile

This file was deleted.

43 changes: 10 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,22 @@
### terraform-provider-ssh

This provider enables SSH port forwarding in Terraform. It is intended as a
This experimental provider enables SSH port forwarding in Terraform. It is intended as a
bandaid [until it is supported in Terraform itself](https://github.com/hashicorp/terraform/issues/8367).

*This provider does not support Terraform v0.12 yet. There were some changes made that makes the upgrade non-trivial.*

#### Example

See [main.tf](main.tf).
See [main.tf](example/main.tf).

#### Installation

On Linux:
Provider can be automatically installed using Terraform >= 0.13 by providing a `terraform` configuration block:

```shell
mkdir -p terraform.d/plugins/linux_amd64
wget https://github.com/stefansundin/terraform-provider-ssh/releases/download/v0.0.4/terraform-provider-ssh_v0.0.4_linux_amd64.zip
unzip terraform-provider-ssh_v0.0.4_linux_amd64.zip -d terraform.d/plugins/linux_amd64
rm terraform-provider-ssh_v0.0.4_linux_amd64.zip
terraform init
```

On Mac:

```shell
mkdir -p terraform.d/plugins/darwin_amd64
wget https://github.com/stefansundin/terraform-provider-ssh/releases/download/v0.0.4/terraform-provider-ssh_v0.0.4_darwin_amd64.zip
unzip terraform-provider-ssh_v0.0.4_darwin_amd64.zip -d terraform.d/plugins/darwin_amd64
rm terraform-provider-ssh_v0.0.4_darwin_amd64.zip
terraform init
terraform {
required_providers {
ssh = {
source = "AndrewChubatiuk/ssh"
}
}
}
```

#### Applying an output file

Note that there is a gotcha when trying to apply a generated plan output file (see [issue #1](https://github.com/stefansundin/terraform-provider-ssh/issues/1)). In this case, the SSH tunnels will not be automatically opened.

As a workaround, before you apply, run the companion program `terraform-open-ssh-tunnels` on the plan file first in order to reopen the SSH tunnels. [Download from the releases.](https://github.com/stefansundin/terraform-provider-ssh/releases/latest)

Because of [this commit](https://github.com/stefansundin/terraform-provider-ssh/commit/37fa9835b75fde095c863fca89e2f28a0169919d), only the SSH agent is currently supported in this program. Let me know if you can think of a good fix for this.

#### TODO

- Support another hop (ProxyJump-like behavior)
- Note that the Windows binary is completely untested!
Loading