terraform-provider-restapi icon indicating copy to clipboard operation
terraform-provider-restapi copied to clipboard

Datasource object has issues with id attribute

Open arun-a-nayagam opened this issue 2 years ago • 0 comments

Hi,

Here's how my datasource object looks like,

data "restapi_object" "app_scripted_demo_client" {
  provider = restapi.restapi_oauth
  path = "/Applications"
  search_key = "Name"
  search_value = "Scripted Demo Client 1"
  id_attribute = "Uuid"
  id = random_uuid.app_scripted_demo_client_uuid.id
  debug = true

  depends_on = [restapi_object.app_scripted_demo_client, random_uuid.app_scripted_demo_client_uuid ]
}

resource "random_uuid" "app_scripted_demo_client_uuid" {
}

resource "restapi_object" "app_scripted_demo_client" {
  provider = restapi.restapi_oauth
...

When I do a terraform plan, it doesn't like the id attribute in the datasource object, without the id attribute it plans fine. Error that I get is

$ terraform plan
2022-08-18T16:46:34.517+0100 [ERROR] vertex "data.restapi_object.app_scripted_demo_client" error: Invalid or unknown key
╷
│ Error: Invalid or unknown key
│
│   with data.restapi_object.app_scripted_demo_client,
│   on apps.tf line 7, in data "restapi_object" "app_scripted_demo_client":
│    7:   id = random_uuid.app_scripted_demo_client_uuid.id

Can you please tell me what is wrong with the id attribute in datasource object.

arun-a-nayagam avatar Aug 18 '22 15:08 arun-a-nayagam