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

URL with path provides invalid port error #91

Open
vertex opened this issue Sep 24, 2021 · 3 comments · May be fixed by #148
Open

URL with path provides invalid port error #91

vertex opened this issue Sep 24, 2021 · 3 comments · May be fixed by #148

Comments

@vertex
Copy link

vertex commented Sep 24, 2021

Configuring a URL with a PATH provides an error, for example:

provider "splunk" {
    url                  = "https://hostname:443/some/path"
    auth_token           = var.splunk_auth_token
    insecure_skip_verify = true
}

Provides the error:

> terraform apply
splunk_saved_searches.saved_search: Refreshing state... [id=Test New Alert]
╷
│ Error: parse "https://https:%2F%2Fhostname:443%2Fsome%2Fpath/servicesNS/-/-/saved/searches?count=-1&output_mode=json": invalid port ":443%2Fsome%2Fpath" after host
│ 
│   with splunk_saved_searches.saved_search,
│   on main.tf line 17, in resource "splunk_saved_searches" "saved_search":
│   17: resource "splunk_saved_searches" "saved_search" {
│ 
@lnwu
Copy link

lnwu commented Dec 14, 2022

try https://hostname:443/some/path -> hostname:443/some/path

@vvbogdanov87
Copy link

I have a similar problem. In my organization splunk url looks like this <hostname>/observability/splunk. I get the error:

Error: parse "https://<hostname>%2Fobservability%2Fsplunk/servicesNS/<irrelevant_url_part>": invalid URL escape "%2F"

I looked into the code and this is what I found:
url is not parsed as URL but used as host. Looks like when Provider is built, url is passed to client.NewSplunkdClient to build a new Client. So url is assigned to Client.host

d.Get("url").(string),

When url.URL is built, the BuildSplunkURL method uses Client.host as Host. The method doesn't parse host and doesn't interpret the part after / as Path.

@vvbogdanov87 vvbogdanov87 linked a pull request Jan 18, 2023 that will close this issue
@bhosaleswapnil2103
Copy link

bhosaleswapnil2103 commented Dec 7, 2023

I am still getting error.

splunk_saved_searches.new-search-01: Creating...

│ Error: parse "https://myURL%2Fen-US%2Fapp%2Fsearch/servicesNS/user01/search/saved/searches?count=-1&output_mode=json": invalid URL escape "%2F"

│ with splunk_saved_searches.new-search-01,
│ on main.tf line 15, in resource "splunk_saved_searches" "new-search-01":
│ 15: resource "splunk_saved_searches" "new-search-01" {

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 a pull request may close this issue.

4 participants