Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changes/v1.0.0/17-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* **New Resource:** `vcfa_rights_bundle` to manage Rights Bundles [GH-17]
* **New Data Source:** `vcfa_rights_bundle` to read existing Rights Bundles [GH-17]
58 changes: 58 additions & 0 deletions vcfa/datasource_vcfa_rights_bundle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package vcfa

import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func datasourceVcfaRightsBundle() *schema.Resource {
return &schema.Resource{
ReadContext: datasourceVcfaRightsBundleRead,
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: fmt.Sprintf("Name of the %s", labelVcfaRightsBundle),
},
"description": {
Type: schema.TypeString,
Computed: true,
Description: fmt.Sprintf("%s description", labelVcfaRightsBundle),
},
"bundle_key": {
Type: schema.TypeString,
Computed: true,
Description: "Key used for internationalization",
},
"read_only": {
Type: schema.TypeBool,
Computed: true,
Description: fmt.Sprintf("Whether this %s is read-only", labelVcfaRightsBundle),
},
"rights": {
Type: schema.TypeSet,
Computed: true,
Description: fmt.Sprintf("Set of %ss assigned to this %s", labelVcfaRight, labelVcfaRightsBundle),
Elem: &schema.Schema{Type: schema.TypeString},
},
"publish_to_all_orgs": {
Type: schema.TypeBool,
Computed: true,
Description: fmt.Sprintf("When true, publishes the %s to all %ss", labelVcfaRightsBundle, labelVcfaOrg),
},
"org_ids": {
Type: schema.TypeSet,
Computed: true,
Description: fmt.Sprintf("Set of %ss to which this %s is published", labelVcfaOrg, labelVcfaRightsBundle),
Elem: &schema.Schema{Type: schema.TypeString},
},
},
}
}

func datasourceVcfaRightsBundleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
return genericVcfaRightsBundleRead(ctx, d, meta, "datasource", "read")
}
2 changes: 2 additions & 0 deletions vcfa/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var globalDataSourceMap = map[string]*schema.Resource{
"vcfa_org_oidc": datasourceVcfaOrgOidc(), // 1.0
"vcfa_org_networking": datasourceVcfaOrgNetworking(), // 1.0
"vcfa_right": datasourceVcfaRight(), // 1.0
"vcfa_rights_bundle": datasourceVcfaRightsBundle(), // 1.0
}

var globalResourceMap = map[string]*schema.Resource{
Expand All @@ -68,6 +69,7 @@ var globalResourceMap = map[string]*schema.Resource{
"vcfa_edge_cluster_qos": resourceVcfaEdgeClusterQos(), // 1.0
"vcfa_org_oidc": resourceVcfaOrgOidc(), // 1.0
"vcfa_org_networking": resourceVcfaOrgNetworking(), // 1.0
"vcfa_rights_bundle": resourceVcfaRightsBundle(), // 1.0
}

// Provider returns a terraform.ResourceProvider.
Expand Down
Loading