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

azurerm_route fails if name attribute contains a slash #6053

Closed
yves-vogl opened this issue Mar 10, 2020 · 4 comments · Fixed by #6055
Closed

azurerm_route fails if name attribute contains a slash #6053

yves-vogl opened this issue Mar 10, 2020 · 4 comments · Fixed by #6055

Comments

@yves-vogl
Copy link
Contributor

Terraform (and AzureRM Provider) Version

Terraform v0.12.21

Affected Resource(s)

  • azurerm_v1.44.0_x4

Terraform Configuration Files

If you create a route which includes a slash character in its name, the API call gets corrupted.

resource "azurerm_route" "example_route" {
      + address_prefix         = "10.255.16.24/32"
      + id                     = (known after apply)
      + name                   = "10.255.16.24/32"
      + next_hop_in_ip_address = "192.168.2.44"
      + next_hop_type          = "VirtualAppliance"
      + resource_group_name    = "example"
      + route_table_name       = "example"
    }

Debug Output

Error: Error Creating/Updating Route "10.255.16.24/32" (Route Table "example" / Resource Group "example"): network.RoutesClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="Failed" Message="The async operation failed." AdditionalInfo=[{"Message":"No HTTP resource was found that matches the request URI 'https://westeurope.network.azure.com:30071/redacted/redacted/subscriptions/redacted/resourceGroups/example/providers/Microsoft.Network/routeTables/main/routes/10.255.16.24/32?api-version=2019-09-01'."}]

Expected Behavior

If the name attribute is used, it should be safely URL encoded.

Actual Behavior

Due to missing encoding, the attribute name could lead to wrong URL components (e.g. a slash in its value is interpreted as path separator. Maybe that could be an injection issue, too.

@yves-vogl
Copy link
Contributor Author

OK, I'll fix this. Found out that there's a validation rule which should be used.

(The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.)

@yves-vogl
Copy link
Contributor Author

Alright, tests have passed. Please get back to me if there's something to improve @tombuildsstuff :-)

jackofallops added a commit that referenced this issue Apr 23, 2020
azurerm_route - add validation to routing table name and route name (#6053)
@katbyte katbyte added this to the v2.7.0 milestone Apr 23, 2020
@ghost
Copy link

ghost commented Apr 23, 2020

This has been released in version 2.7.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.7.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 24, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators May 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants