From 298fcd7cb096bff5818ccf85327eab92e48ae9b3 Mon Sep 17 00:00:00 2001 From: Kian Parvin Date: Fri, 22 Nov 2024 08:53:26 +0200 Subject: [PATCH] chore: update imports and added example --- docs/data-sources/jaas_group.md | 18 +++++++++++++++++- .../juju_jaas_group/data-source.tf | 13 +++++++++++++ internal/provider/data_source_jaas_group.go | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 examples/data-sources/juju_jaas_group/data-source.tf diff --git a/docs/data-sources/jaas_group.md b/docs/data-sources/jaas_group.md index 4deb7eb0..15e7a77d 100644 --- a/docs/data-sources/jaas_group.md +++ b/docs/data-sources/jaas_group.md @@ -10,7 +10,23 @@ description: |- A data source representing a Juju JAAS Group. - +## Example Usage + +```terraform +resource "juju_jaas_group" "test" { + name = "group-0" +} + +data "juju_jaas_group" "test" { + name = juju_jaas_group.test.name + // from a separate plan use a string literal + // name = "group-0" +} + +output "group_uuid" { + value = data.juju_jaas_group.test.uuid +} +``` ## Schema diff --git a/examples/data-sources/juju_jaas_group/data-source.tf b/examples/data-sources/juju_jaas_group/data-source.tf new file mode 100644 index 00000000..9904c9b2 --- /dev/null +++ b/examples/data-sources/juju_jaas_group/data-source.tf @@ -0,0 +1,13 @@ +resource "juju_jaas_group" "test" { + name = "group-0" +} + +data "juju_jaas_group" "test" { + name = juju_jaas_group.test.name + // from a separate plan use a string literal + // name = "group-0" +} + +output "group_uuid" { + value = data.juju_jaas_group.test.uuid +} diff --git a/internal/provider/data_source_jaas_group.go b/internal/provider/data_source_jaas_group.go index 1352eaeb..462a839d 100644 --- a/internal/provider/data_source_jaas_group.go +++ b/internal/provider/data_source_jaas_group.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/juju/terraform-provider-juju/internal/juju" )