From 965a876fa68d4c92bdd0fb1c1cebf05ac9aef436 Mon Sep 17 00:00:00 2001 From: Todd Stansell Date: Fri, 22 Apr 2022 08:22:50 -0700 Subject: [PATCH] fix tunnel route import --- cloudflare/resource_cloudflare_teams_route.go | 7 +++---- website/docs/r/teams_route.html.markdown | 13 +++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cloudflare/resource_cloudflare_teams_route.go b/cloudflare/resource_cloudflare_teams_route.go index 84430ea892..7c43f1a4b2 100644 --- a/cloudflare/resource_cloudflare_teams_route.go +++ b/cloudflare/resource_cloudflare_teams_route.go @@ -112,17 +112,16 @@ func resourceCloudflareTeamsRouteDelete(d *schema.ResourceData, meta interface{} } func resourceCloudflareTeamsRouteImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - attributes := strings.SplitN(d.Id(), "/", 3) + attributes := strings.SplitN(d.Id(), "/", 2) if len(attributes) != 2 { - return nil, fmt.Errorf(`invalid id (%q) specified, should be in format "accountID/tunnelID/network"`, d.Id()) + return nil, fmt.Errorf(`invalid id (%q) specified, should be in format "accountID/network"`, d.Id()) } - accountID, tunnelID, network := attributes[0], attributes[1], attributes[2] + accountID, network := attributes[0], attributes[1] d.SetId(network) d.Set("account_id", accountID) - d.Set("tunnel_id", tunnelID) d.Set("network", network) err := resourceCloudflareTeamsRouteRead(d, meta) diff --git a/website/docs/r/teams_route.html.markdown b/website/docs/r/teams_route.html.markdown index cd9fecd892..c8eea63e80 100644 --- a/website/docs/r/teams_route.html.markdown +++ b/website/docs/r/teams_route.html.markdown @@ -14,11 +14,12 @@ routes are used to direct IP traffic through Cloudflare Tunnels. ## Example Usage ```hcl -resource "cloudflare_teams_route" "example" +resource "cloudflare_teams_route" "example" { account_id = "c4a7362d577a6c3019a474fd6f485821" - tunnel_id = "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" - network = "192.0.2.24/32" - comment = "New tunnel route for documentation" + tunnel_id = "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" + network = "192.0.2.24/32" + comment = "New tunnel route for documentation" +} ``` ## Argument Reference @@ -32,8 +33,8 @@ The following arguments are supported: ## Import -An existing tunnel route can be imported using the account ID, tunnel ID, and network CIDR. +An existing tunnel route can be imported using the account ID and network CIDR. ``` -$ terraform import cloudflare_teams_route c4a7362d577a6c3019a474fd6f485821/f70ff985-a4ef-4643-bbbc-4a0ed4fc8415/192.0.2.24/32 +$ terraform import cloudflare_teams_route c4a7362d577a6c3019a474fd6f485821/192.0.2.24/32 ```