1

When I run terraform apply in a new workspace, I get

openstack_networking_port_secgroup_associate_v2.network_project_k3s: Creation complete after 1s [id=4543b73b-541e-40c3-a311-5b1f553b9d58]
╷
│ Error: Error trying to get network information from the Network API: More than one network found for name net_project
│ 
│   with openstack_compute_instance_v2.test-server,
│   on main.tf line 137, in resource "openstack_compute_instance_v2" "test-server":
│  137: resource "openstack_compute_instance_v2" "test-server" {

I suppose I'm getting this because OpenStack's network names are globally unique. How can I incorporate the workspace name in the network name?

resource "openstack_networking_network_v2" "net_project" {
  name           = "net_project_${WORKSPACE}"
  admin_state_up = "true"
}
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85

1 Answers1

2

The variable I ended up using was

${terraform.workspace}

You can find more information about it under "Current Workspace Interpolation"

Evan Carroll
  • 2,921
  • 6
  • 37
  • 85