Error with regex using vpc datasource
Hello,
I am using the VPC datasource to retrieve the data. But I am receiving the following error:
Error: No VPC is matching with the specified regex
It occurs even when changing and using any other filter.
My main.tf
terraform {
required_providers {
cloudstack = {
source = "cloudstack/cloudstack"
version = "0.5.0"
}
}
}
provider "cloudstack" {
api_url = "https://<my_cloudstack_url>/client/api"
api_key = "${var.cloudstack_api_key}"
secret_key = "${var.cloudstack_secret_key}"
}
variable "cloudstack_api_key" {
description = "API KEY for CloudStack"
type = string
}
variable "cloudstack_secret_key" {
description = "SECRET KEY for CloudStack"
type = string
}
My data.tf
data "cloudstack_vpc" "vpc" {
filter{
name = "cidr"
value = "10.25.0.0/16"
}
filter{
name = "name"
value = "boilerplate"
}
filter{
name = "project"
value = "boilerplate"
}
}
I tried using the datasource with all the filters, but I also tried one filter at a time to identify any issues with the values.
Hi @ferdinandopaes,
I tried reproducing it and the data sources don't actually list project resources, even the two (IpAddress and VPC) that have a project filter. They simply call their respective list APIs without any parameters. It seems simple enough to fix and I'll open a PR soon, if no one is already working on it.
But, for now, could you try with resources owned directly by accounts, not projects?
Hi @gpordeus,
I tried retrieve data directly by accounts, with a vpc out of project and its work fine!!! Thanks for the workaround.
I'll waiting for the PR.
@gpordeus are you working on a PR for this issue
this seems to be addessed by #144
related work on project support: #167 #82