Skip to content

Conversation

@stefansundin
Copy link
Owner

@stefansundin stefansundin commented Aug 21, 2019

A proof-of-concept. Fixes #11.

See:

Due to changes in the plugin lifecycle in Terraform v0.12, things get a lot more complicated. To work around that, when the provider is started, it launches a copy of itself that sticks around until the main terraform process has exited. The copy starts a gRPC server that accepts connections from the ssh_tunnel data sources, and opens and keeps the SSH tunnels alive.

I haven't done thorough testing yet, but it seems to work great. There are a few TODOs in there as well. Please let me know what you think!

@mirnujAtom
Copy link
Contributor

Hey @stefansundin, it's so great to hear that the project is alive!
Will definitely test it our and provide feedback :)

@mirnujAtom
Copy link
Contributor

Hey @stefansundin
Just tested the provider with tf12, Great Job!

The only issue I had is that looks like there is no value for Port returned from "client.grpcClient.OpenTunnel" on line 110, so I had to cut the port from local_address (EffectiveAddress) to be able to use a random port in TF:

               if resp.EffectiveAddress != localAddress {
			log.Printf("[DEBUG] localAddress: %v", resp.EffectiveAddress)
			d.Set("local_address", resp.EffectiveAddress)
		}
		d.Set("port", resp.Port)

//Dirty fix goes here --> 
		la := d.Get("local_address").(string)
		lc := strings.LastIndex(la,":")
		d.Set("port", la[lc+1:len(la)])

@stefansundin
Copy link
Owner Author

I noticed that bug as well, but I didn't manage to track it down. I will try to take another look soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform 0.12 support

3 participants