feat: Add scm_device resource and data sources for device-to-folder management#94
Open
CrazyLegsCooper-Qumodity wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
feat: Add
scm_deviceresource and data sources for device-to-folder managementProblem
Azure vWAN-connected firewalls onboarded into Strata Cloud Manager appear under "All Firewalls" but cannot be moved into the correct folder hierarchy (e.g. "Azure Firewalls > Production Services") via Terraform. The SCM API supports device-to-folder assignment through its Devices PUT endpoint, and the SDK already had the
DevicesandDevicesPutmodel structs generated from the OpenAPI spec, but no API service was wired up — and the Terraform provider had no corresponding resource or data source.Solution
New resource:
scm_device— an adopt-and-manage resource that allows Terraform to manage an existing device's folder assignment, labels, snippets, description, and display name.New data sources:
scm_device— look up a single device by UUID.scm_device_list— list devices with optional folder filter, limit, and offset.Usage Example
Changes
Modified files:
go.mod— added local replace directive for scm-go development (to be updated to module version before merge)internal/provider/config_setup/resources.go— registeredNewDeviceResourceinternal/provider/config_setup/datasources.go— registeredNewDeviceDataSourceandNewDeviceListDataSourceNew files:
internal/models/config_setup/model_devices.go— Terraform schema model with resource, data source, and list data source schemasinternal/models/config_setup/model_devices_test.go— schema validation tests (7 tests)internal/provider/config_setup/resource_device.go—scm_deviceresource implementationinternal/provider/config_setup/resource_device_mappers.go— pack/unpack functions between TF model and SDK structsinternal/provider/config_setup/resource_device_mappers_test.go— mapper unit tests (8 tests)internal/provider/config_setup/data_source_device.go—scm_devicedata sourceinternal/provider/config_setup/data_source_device_list.go—scm_device_listdata sourceCompanion PR
This PR depends on a corresponding change in the scm-go SDK (PaloAltoNetworks/scm-go#20) that adds the
DevicesAPIServicewithListDevices,GetDeviceByID, andUpdateDeviceByIDmethods. Thego.modreplace directive should be updated to point to the published scm-go version once that SDK PR is merged and tagged.Testing
go test ./internal/... -vgo build ./...compiles clean