kiran badiger
kiran badiger

Reputation: 71

Error: host is invalid. parse "https://identity.us-ashburn-1\r.oraclecloud.com": net/url: invalid control character in URL

I am running terraform script which will provision the Oracle DBS in OCI

when I run terraform plan

I'm getting below error

enter image description here

Source code:

data "oci_identity_availability_domains" "ADs" { compartment_id = var.tenancy_ocid }

Help me to solve this issue

Upvotes: 1

Views: 1144

Answers (3)

kiran badiger
kiran badiger

Reputation: 71

I found the answer, the problem is that I had setup the region in Environment Variables, I have used source env_var.sh command to set the environment variables, it included \r (Carriage Return) at the end of the line.

So just set the Environment variables using export TF_VAR_region="us-ashburn-1" command

Thanks to Martin Atkins and JeromeFr

Upvotes: 1

rashik
rashik

Reputation: 1

I was able to run this sample: `

variable "tenancy_ocid" {}
variable "user_ocid" {}
variable "fingerprint" {}
variable "private_key_path" {}
variable "region" {}
variable "compartment_ocid" {}

provider "oci" {
 tenancy_ocid     = var.tenancy_ocid
 user_ocid        = var.user_ocid
 fingerprint      = var.fingerprint
 private_key_path = var.private_key_path
 region           = var.region
}

data "oci_identity_availability_domains" "ads" {
 compartment_id = var.tenancy_ocid
}

output "ads" {
 value = data.oci_identity_availability_domains.ads.availability_domains
}

data "oci_identity_availability_domain" "ad" {
 compartment_id = var.tenancy_ocid
 ad_number      = 2
}

I ran this on provider version: 4.44.0 and using 12.31 Terraform version.

Upvotes: 0

JeromeFr
JeromeFr

Reputation: 1928

The \r is not supposed to be there in the url. You probably have a newline in our terraform script. I would remove it and try again.

Windows uses both \r (CR for Carriage Return) and \n (LF for Linefeed) for a new line while Unix/Linux only uses \n. So if you can't remove the new line, you can make sure that it is compatible for Unix environment. Most text editors allow to convert/choose the new line character.

Upvotes: 2

Related Questions