-
Notifications
You must be signed in to change notification settings - Fork 3
allowing for http api to be used for fleet provider #1
base: master
Are you sure you want to change the base?
Conversation
@@ -58,7 +58,7 @@ func TestGetAPI(test *testing.T) { | |||
// when the address is an empty string, we get a nullAPI | |||
var api client.API | |||
|
|||
api, err := getAPI("", 1) | |||
api, err := getAPI("null", "endpoint", 1, "etcd_prefix") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be testing "when the address is an empty string, we get a nullAPI", though maybe it doesn't matter anymore. It used to be that if the tunnel_address
was something like ${aws_instance.coreos.public_ip}
, then when terraform would expand that variable in the planning stage, before that instance existed, it would expand it to an empty string. When that happened, all we needed to do was to not fail, and then when Terraform would get to the apply stage it wouldn't initialize the fleet provider until after the instance was actually created, and by then we'd have the real IP address and could work normally.
However, this doesn't seem to work in more recent versions of Terraform, for reasons I haven't yet fully investigated. hashicorp/terraform#2430 has a bit more context.
Until that's sorted out, perhaps it's best to retain the old behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the comments on that linked thread:
"""
The workaround for this problem is to explicitly split the problem into two steps: make one Terraform config that creates the EC2 instance and produces the instance IP address as an output, publish the state from that configuration somewhere, and then use the terraform_remote_state resource to reference that from a separate downstream config that sets up the Docker resources.
"""
So that's what I'm doing currently, but I'll add back in that expected functionality in the case of an empty string. I didn't understand why it was operating that way but it makes sense. I'll keep up on that ticket as well.
``` | ||
provider "fleet" { | ||
driver = "api" | ||
endpoint = "http://192.168.0.1:4001" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
driver = "api"
means to use the fleet HTTP API, not frobbing etcd directly, right? If so, it's pretty unlikely the endpoint would be on port 4001 in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, that's a bad example I didn't mean to push
I need update docs, just allows for creating an api client with an http endpoint without going through ssh.