diff --git a/.ci-mgmt.yaml b/.ci-mgmt.yaml index 7637a1cf..1d4ca234 100644 --- a/.ci-mgmt.yaml +++ b/.ci-mgmt.yaml @@ -23,3 +23,5 @@ actions: run: | cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt pulumiConvert: 1 +registryDocs: true + diff --git a/Makefile b/Makefile index a966fdfd..892a81d5 100644 --- a/Makefile +++ b/Makefile @@ -167,6 +167,10 @@ build_python: .make/build_python @touch $@ .PHONY: generate_python build_python +# Run the bridge's registry-docs command to generated the content of the installation docs/ folder at provider repo root +build_registry_docs: + $(WORKING_DIR)/bin/$(TFGEN) registry-docs --out $(WORKING_DIR)/docs + clean: rm -rf sdk/{dotnet,nodejs,go,python} rm -rf bin/* diff --git a/docs/_index.md b/docs/_index.md index a6fb1391..41bdc432 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -1,8 +1,132 @@ --- -title: Cisco Catalyst SD-WAN -meta_desc: Provides an overview of the Cisco Catalyst SD-WAN Provider for Pulumi. -layout: overview +# *** WARNING: This file was auto-generated. Do not edit by hand unless you're certain you know what you are doing! *** +title: Cisco Catalyst SD-WAN Provider +meta_desc: Provides an overview on how to configure the Pulumi Cisco Catalyst SD-WAN provider. +layout: package --- +## Installation -A Pulumi package for resources to interact with a Cisco Catalyst SD-WAN environment. +The Cisco Catalyst SD-WAN provider is available as a package in all Pulumi languages: +* JavaScript/TypeScript: [`@pulumi/sdwan`](https://www.npmjs.com/package/@pulumi/sdwan) +* Python: [`pulumi-sdwan`](https://pypi.org/project/pulumi-sdwan/) +* Go: [`github.com/pulumi/pulumi-sdwan/sdk/go/sdwan`](https://github.com/pulumi/pulumi-sdwan) +* .NET: [`Pulumi.Sdwan`](https://www.nuget.org/packages/Pulumi.Sdwan) +* Java: [`com.pulumi/sdwan`](https://central.sonatype.com/artifact/com.pulumi/sdwan) +## Overview + +The SDWAN provider provides resources to interact with a Cisco Catalyst SD-WAN environment. It communicates with the SD-WAN Manager via the REST API. + +All resources and functions have been tested with the following releases. + +| Platform | Version | +|-----------------|---------| +| Catalyst SD-WAN | 20.9 | +| Catalyst SD-WAN | 20.12 | +## Example Usage + +{{< chooser language "typescript,python,go,csharp,java,yaml" >}} +{{% choosable language typescript %}} +```yaml +# Pulumi.yaml provider configuration file +name: configuration-example +runtime: nodejs +config: + sdwan:password: + value: password + sdwan:url: + value: https://10.1.1.1 + sdwan:username: + value: admin + +``` + +{{% /choosable %}} +{{% choosable language python %}} +```yaml +# Pulumi.yaml provider configuration file +name: configuration-example +runtime: python +config: + sdwan:password: + value: password + sdwan:url: + value: https://10.1.1.1 + sdwan:username: + value: admin + +``` + +{{% /choosable %}} +{{% choosable language csharp %}} +```yaml +# Pulumi.yaml provider configuration file +name: configuration-example +runtime: dotnet +config: + sdwan:password: + value: password + sdwan:url: + value: https://10.1.1.1 + sdwan:username: + value: admin + +``` + +{{% /choosable %}} +{{% choosable language go %}} +```yaml +# Pulumi.yaml provider configuration file +name: configuration-example +runtime: go +config: + sdwan:password: + value: password + sdwan:url: + value: https://10.1.1.1 + sdwan:username: + value: admin + +``` + +{{% /choosable %}} +{{% choosable language yaml %}} +```yaml +# Pulumi.yaml provider configuration file +name: configuration-example +runtime: yaml +config: + sdwan:password: + value: password + sdwan:url: + value: https://10.1.1.1 + sdwan:username: + value: admin + +``` + +{{% /choosable %}} +{{% choosable language java %}} +```yaml +# Pulumi.yaml provider configuration file +name: configuration-example +runtime: java +config: + sdwan:password: + value: password + sdwan:url: + value: https://10.1.1.1 + sdwan:username: + value: admin + +``` + +{{% /choosable %}} +{{< /chooser >}} +## Configuration Reference + +- `insecure` (Boolean) Allow insecure HTTPS client. This can also be set as the `SDWAN_INSECURE` environment variable. Defaults to `true`. +- `password` (String, Sensitive) Password for the SD-WAN Manager account. This can also be set as the `SDWAN_PASSWORD` environment variable. +- `retries` (Number) Number of retries for REST API calls. This can also be set as the `SDWAN_RETRIES` environment variable. Defaults to `3`. +- `url` (String) URL of the Cisco SD-WAN Manager device. This can also be set as the `SDWAN_URL` environment variable. +- `username` (String) Username for the SD-WAN Manager account. This can also be set as the `SDWAN_USERNAME` environment variable. \ No newline at end of file diff --git a/provider/resources.go b/provider/resources.go index efc065af..f2b038c3 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -15,6 +15,7 @@ package provider import ( + "bytes" "context" "fmt" "path/filepath" @@ -27,6 +28,7 @@ import ( pf "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" tfbridgetokens "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-sdwan/provider/pkg/version" @@ -83,6 +85,7 @@ func Provider() tfbridge.ProviderInfo { TFProviderVersion: "0.4.1", Version: version.Version, Config: map[string]*tfbridge.SchemaInfo{}, + DocRules: &tfbridge.DocRuleInfo{EditRules: docEditRules}, Resources: map[string]*tfbridge.ResourceInfo{ "sdwan_activate_centralized_policy": {ComputeID: StaticID("sdwan:activateCentralizedPolicy")}, "sdwan_attach_feature_device_template": {ComputeID: StaticID("sdwan:attachFeatureDeviceTemplate")}, @@ -140,3 +143,29 @@ func Provider() tfbridge.ProviderInfo { return prov } + +func docEditRules(defaults []tfbridge.DocsEdit) []tfbridge.DocsEdit { + return append( + defaults, + trimWhitespace, + skipGettingStartedSection, + ) +} + +// Removes a blank line at the beginning of the doc +var trimWhitespace = tfbridge.DocsEdit{ + Path: "index.md", + Edit: func(_ string, content []byte) ([]byte, error) { + return bytes.TrimSpace(content), nil + }, +} + +// Strips an upstream Getting Started section +var skipGettingStartedSection = tfbridge.DocsEdit{ + Path: "index.md", + Edit: func(_ string, content []byte) ([]byte, error) { + return tfgen.SkipSectionByHeaderContent(content, func(headerText string) bool { + return headerText == "Getting Started" + }) + }, +}