Error when building workspace with parametrized OpenStack provider using coder parameters

Hi, when I use coder parameters to parametrize OpenStack provider like this:
provider "openstack" {
application_credential_id = data.coder_parameter.application_credential_id.value
application_credential_name = data.coder_parameter.application_credential_name.value
application_credential_secret = data.coder_parameter.application_credential_secret.value
...
provider "openstack" {
application_credential_id = data.coder_parameter.application_credential_id.value
application_credential_name = data.coder_parameter.application_credential_name.value
application_credential_secret = data.coder_parameter.application_credential_secret.value
...
and then i do
data "openstack_images_image_v2" "nodes_image" {
name = "ubuntu-jammy-x86_64"
}
data "openstack_images_image_v2" "nodes_image" {
name = "ubuntu-jammy-x86_64"
}
I am getting Error creating OpenStack image client: You must provide a password to authenticate on .terraform/modules/kubernetes_infra/instances.tf line 1 I don't know if this is right place to discuss this issue, but this behavior is happening only in coder. when i parametrize provider with standard variables, terraform plan is already expecting variables to be filled. Any idea how to bypass this issue? When providing the values directly everything works.
6 Replies
Codercord
Codercord3mo ago
<#1299379651810168832>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys3mo ago
hey @Andrej could you send your full template over?
Andrej
AndrejOP2mo ago
terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
}
coder = {
source = "coder/coder"
version = "1.0.4"
}
}
}

data "coder_parameter" "project_id" {
name = "project_id"
description = "Project id"
type = "string"
mutable = false
}
data "coder_parameter" "application_credential_name" {
name = "application_credential_name"
description = "application_credential_name"
type = "string"
mutable = false
}
data "coder_parameter" "application_credential_id" {
name = "application_credential_id"
description = "application_credential_id"
type = "string"
mutable = false
}
data "coder_parameter" "application_credential_secret" {
name = "application_credential_secret"
description = "application_credential_secret"
type = "string"
mutable = false
}

provider "openstack" {
application_credential_id = data.coder_parameter.application_credential_id.value
application_credential_name = data.coder_parameter.application_credential_name.value
application_credential_secret = data.coder_parameter.application_credential_secret.value
tenant_id = data.coder_parameter.project_id.value
auth_url = <my_auth_url>
region = <my_os_region>
allow_reauth = true
}

data "openstack_images_image_v2" "nodes_image" {
name = "ubuntu-jammy-x86_64"
}
terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
}
coder = {
source = "coder/coder"
version = "1.0.4"
}
}
}

data "coder_parameter" "project_id" {
name = "project_id"
description = "Project id"
type = "string"
mutable = false
}
data "coder_parameter" "application_credential_name" {
name = "application_credential_name"
description = "application_credential_name"
type = "string"
mutable = false
}
data "coder_parameter" "application_credential_id" {
name = "application_credential_id"
description = "application_credential_id"
type = "string"
mutable = false
}
data "coder_parameter" "application_credential_secret" {
name = "application_credential_secret"
description = "application_credential_secret"
type = "string"
mutable = false
}

provider "openstack" {
application_credential_id = data.coder_parameter.application_credential_id.value
application_credential_name = data.coder_parameter.application_credential_name.value
application_credential_secret = data.coder_parameter.application_credential_secret.value
tenant_id = data.coder_parameter.project_id.value
auth_url = <my_auth_url>
region = <my_os_region>
allow_reauth = true
}

data "openstack_images_image_v2" "nodes_image" {
name = "ubuntu-jammy-x86_64"
}
this is the bare minimum that is failing
Phorcys
Phorcys2mo ago
@Andrej try to define the user_name and password values (or token) in the provider block
Andrej
AndrejOP2mo ago
but what values shall i use? i dont have username and password
Phorcys
Phorcys2mo ago
you have to supply the provider with a way to authenticate with your OpenStack instance

Did you find this page helpful?