-
Notifications
You must be signed in to change notification settings - Fork 6
Add vcfa_org_regional_networking resource and data source #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
386ce1d
Add vcfa_org_networking resource + data source
Didainius 73294fd
Patch test, changelog
Didainius c5a8d9f
Self review, tests
Didainius 4925f9e
Latest govcd
Didainius 16ae54d
make static
Didainius ab31557
WIP
Didainius 7761973
Merge branch 'main' into org-region-network
Didainius 08cddf0
Fix go.mod
Didainius 3ccd226
WIP
Didainius 1cb887e
Update config sample
Didainius cfd9e5b
Merge branch 'main' into org-region-network
Didainius 94be0df
Self review
Didainius 359ceee
Address comments
Didainius 86031df
Use Async creation to recover ID in a tainted resource after failure
Didainius 8ab8781
Merge branch 'main' into org-region-network
Didainius caae5cc
Bump SDK
Didainius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - **New Resource:** `vcfa_org_regional_networking` to manage Org Regional Networking Settings [GH-18] | ||
| - **New Data Source:** `vcfa_org_regional_networking` to read Org Regional Networking Settings [GH-18] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package vcfa | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
| "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
| "github.com/vmware/go-vcloud-director/v3/govcd" | ||
| "github.com/vmware/go-vcloud-director/v3/types/v56" | ||
| ) | ||
|
|
||
| func datasourceVcfaOrgRegionalNetworking() *schema.Resource { | ||
| return &schema.Resource{ | ||
| ReadContext: datasourceVcfaOrgRegionalNetworkingRead, | ||
|
|
||
| Schema: map[string]*schema.Schema{ | ||
| "name": { | ||
| Type: schema.TypeString, | ||
| Required: true, | ||
| Description: fmt.Sprintf("Name of %s", labelVcfaRegionalNetworkingSetting), | ||
| }, | ||
| "org_id": { | ||
| Type: schema.TypeString, | ||
| Required: true, | ||
| Description: fmt.Sprintf("Parent %s ID for %s", labelVcfaOrg, labelVcfaRegionalNetworkingSetting), | ||
| }, | ||
| "provider_gateway_id": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| Description: fmt.Sprintf("Parent %s ID for %s", labelVcfaProviderGateway, labelVcfaRegionalNetworkingSetting), | ||
| }, | ||
| "region_id": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| Description: fmt.Sprintf("Parent %s ID for %s", labelVcfaRegion, labelVcfaRegionalNetworkingSetting), | ||
| }, | ||
| "edge_cluster_id": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| Description: fmt.Sprintf("Backing %s ID for %s. Will be autoselected if not specified.", labelVcfaEdgeCluster, labelVcfaRegionalNetworkingSetting), | ||
| }, | ||
| "status": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| Description: fmt.Sprintf("Status of %s", labelVcfaRegionalNetworkingSetting), | ||
| }, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func datasourceVcfaOrgRegionalNetworkingRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
| vcfaClient := meta.(*VCDClient) | ||
|
|
||
| getTmRegionalNetworkingSettingByName := func(name string) (*govcd.TmRegionalNetworkingSetting, error) { | ||
| return vcfaClient.GetTmRegionalNetworkingSettingByNameAndOrgId(name, d.Get("org_id").(string)) | ||
| } | ||
|
|
||
| c := dsReadConfig[*govcd.TmRegionalNetworkingSetting, types.TmRegionalNetworkingSetting]{ | ||
| entityLabel: labelVcfaRegionalNetworkingSetting, | ||
| getEntityFunc: getTmRegionalNetworkingSettingByName, | ||
| stateStoreFunc: setTmRegionalNetworkingSettingData, | ||
| } | ||
| return readDatasource(ctx, d, meta, c) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.