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

Add new resource cloudflare_argo_tunnel #905

Merged
merged 1 commit into from
Jan 28, 2021
Merged

Conversation

jacobbednarz
Copy link
Member

@jacobbednarz jacobbednarz commented Jan 6, 2021

Creates a new resource for managing Argo Tunnels.

Depends on cloudflare/cloudflare-go#572 for V4 response structure.

Closes #603

}

func resourceCloudflareArgoTunnelUpdate(d *schema.ResourceData, meta interface{}) error {
return nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to do something here to stop in place updates from being a possibility. will have a dig around and see what options we have.

}

func resourceCloudflareArgoTunnelRead(d *schema.ResourceData, meta interface{}) error {
return nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource is read only once created so 🤷‍♂️ nothing to sync


* `account_id` - (Required) The Cloudflare account ID that you wish to manage the Argo Tunnel on.
* `name` - (Required) A user-friendly name chosen when the tunnel is created. Cannot be empty.
* `secret` - (Required) 32 or more bytes, encoded as a base64 string. The Create Argo Tunnel endpoint sets this as the tunnel's password. Anyone wishing to run the tunnel needs this password.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up..I'm not sure how the cloudflare-go library handles this, but the HTTP API does not have the requirement that the secret be a base64 string (it might not even have the requirement that it be 32 bytes or more, but all my scripts use 32 bytes or more so I can't say off the top of my head).

When the secret is auto generated by the cloudflared cli tool, it generates a base64 encoded string, but I think that is just their quick way of generating a random string.

I've used long strings generated with password generators with no problem.

Copy link
Member Author

@jacobbednarz jacobbednarz Jan 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirement is documented (also where I stole this line from) and is enforced by the API schema.

In terms of how cloudflare-go handles this, it only passes on the string it is sent. It does not check for base64 encoding or the length. Instead, it will error out if the API errors out. Same principle here where we don't actually enforce it and instead offload that to the API itself.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, interesting. Thanks for the link @jacobbednarz. Looks like a mistake on our side, however I can report that the CF API (at least before christmas, when I last poked it) doesn't error out if you pass an invalid base64 string. Will update our code though to comply with the docs in the event it starts being enforced.

Creates a new resource for managing Argo Tunnels.

Closes #603
@jacobbednarz jacobbednarz merged commit ab05da9 into master Jan 28, 2021
@jacobbednarz jacobbednarz deleted the argo-tunnel-resource branch January 28, 2021 00:09
@jacobbednarz jacobbednarz added this to the 2.18.0 milestone Jan 28, 2021
@jacobbednarz
Copy link
Member Author

this has been released in v2.18.0

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.

Feature: Add resources for Argo Tunnel
3 participants