hashicorp / terraform-provider-boundary

Manage Boundary's identity-based access controls for resources provisioned with Terraform. This provider is maintained internally by the HashiCorp Boundary team.
https://registry.terraform.io/providers/hashicorp/boundary/latest
Mozilla Public License 2.0
100 stars 55 forks source link

Adding Data Sources support to some Resources #311

Open alirezarpi opened 1 year ago

alirezarpi commented 1 year ago

Hi there,

It would be nice if boundary terraform provide supports data, so like this scenario when they're needed at first we can provide them.

Terraform Version

Terraform v1.3.5
on darwin_arm64
+ provider registry.terraform.io/hashicorp/boundary v1.1.2
+ provider registry.terraform.io/hashicorp/random v3.4.3

Your version of Terraform is out of date! The latest version
is 1.3.6. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

data "boundary_user" "admin_user" {
  filter {
    name   = "Name"
    values = ["admin"]
  }
}
data "boundary_user" "terraform_user" {
  filter {
    name   = "Name"
    values = ["terraform"]
  }
}

resource "boundary_role" "my_new_org_admin" {
  name           = "new_org_admin"
  scope_id       = boundary_scope.global.id
  grant_scope_id = boundary_scope.my_new_org.id
  grant_strings  = ["id=*;type=*;actions=*"]
  principal_ids  = [data.boundary_user.admin_user.id, data.boundary_user.terraform_user.id]
}

Debug Output

None.

Panic Output

Non

Expected Behavior

It should give me the users data so I can include the IDs in the next resource.

Actual Behavior

Error: Invalid data source
│
│   on 02-scopes.tf line 14, in data "boundary_user" "admin_user":
│   14: data "boundary_user" "admin_user" {
│
│ The provider hashicorp/boundary does not support data source "boundary_user".
│
│ Did you intend to use the managed resource type "boundary_user"? If so, declare this using a "resource" block instead of a "data" block.
╵
╷
│ Error: Invalid data source
│
│   on 02-scopes.tf line 20, in data "boundary_user" "terraform_user":
│   20: data "boundary_user" "terraform_user" {
│
│ The provider hashicorp/boundary does not support data source "boundary_user".
│
│ Did you intend to use the managed resource type "boundary_user"? If so, declare this using a "resource" block instead of a "data" block.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

None

References

None

patoarvizu commented 1 year ago

I would also be interested in a boundary_worker data source. The use case is to be able to discover the managed HCP workers to more easily configure multi-hop configurations.