ran setup.sh

This commit is contained in:
2025-04-18 13:29:38 -07:00
parent b78296ab5b
commit 0674f1ddab
23 changed files with 195 additions and 123 deletions

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package xyz
package incus
import (
"path"
@@ -24,21 +24,21 @@ import (
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
xyz "github.com/pulumi/terraform-provider-xyz/provider" // Import the upstream provider
incus "github.com/lxc/terraform-provider-incus/provider" // Import the upstream provider
"github.com/pulumi/pulumi-xyz/provider/pkg/version"
"github.com/brandonkal/pulumi-incus/provider/pkg/version"
)
// all of the token components used below.
const (
// This variable controls the default name of the package in the package
// registries for nodejs and python:
mainPkg = "xyz"
mainPkg = "incus"
// modules:
mainMod = "index" // the xyz module
mainMod = "index" // the incus module
)
//go:embed cmd/pulumi-resource-xyz/bridge-metadata.json
//go:embed cmd/pulumi-resource-incus/bridge-metadata.json
var metadata []byte
// Provider returns additional overlaid schema and metadata associated with the provider.
@@ -77,17 +77,17 @@ func Provider() tfbridge.ProviderInfo {
//
// - Replace `shimv2.NewProvider` with `pfbridge.ShimProvider`.
//
// - In provider/cmd/pulumi-tfgen-xyz/main.go, replace the
// - In provider/cmd/pulumi-tfgen-incus/main.go, replace the
// "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen" import with
// "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfgen". Remove the `version.Version`
// argument to `tfgen.Main`.
//
// - In provider/cmd/pulumi-resource-xyz/main.go, replace the
// - In provider/cmd/pulumi-resource-incus/main.go, replace the
// "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" import with
// "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge". Replace the arguments to the
// `tfbridge.Main` so it looks like this:
//
// tfbridge.Main(context.Background(), "xyz", xyz.Provider(),
// tfbridge.Main(context.Background(), "incus", incus.Provider(),
// tfbridge.ProviderMetadata{PulumiSchema: pulumiSchema})
//
// Detailed instructions can be found at
@@ -95,7 +95,7 @@ func Provider() tfbridge.ProviderInfo {
// After that, you can proceed as normal.
//
// This is where you give the bridge a handle to the upstream terraform provider. SDKv2
// convention is to have a function at "github.com/pulumi/terraform-provider-xyz/provider".New
// convention is to have a function at "github.com/lxc/terraform-provider-incus/provider".New
// which takes a version and produces a factory function. The provider you are bridging may
// not do that. You will need to find the function (generally called in upstream's main.go)
// that produces a:
@@ -105,9 +105,9 @@ func Provider() tfbridge.ProviderInfo {
// - "github.com/hashicorp/terraform-plugin-framework/provider".Provider (for plugin-framework)
//
//nolint:lll
P: shimv2.NewProvider(xyz.New(version.Version)()),
P: shimv2.NewProvider(incus.New(version.Version)()),
Name: "xyz",
Name: "incus",
Version: version.Version,
// DisplayName is a way to be able to change the casing of the provider name when being
// displayed on the Pulumi registry
@@ -125,14 +125,14 @@ func Provider() tfbridge.ProviderInfo {
// for use in Pulumi programs
// e.g. https://github.com/org/pulumi-provider-name/releases/download/v${VERSION}/
PluginDownloadURL: "",
Description: "A Pulumi package for creating and managing xyz cloud resources.",
Description: "A Pulumi package for creating and managing incus cloud resources.",
// category/cloud tag helps with categorizing the package in the Pulumi Registry.
// For all available categories, see `Keywords` in
// https://www.pulumi.com/docs/guides/pulumi-packages/schema/#package.
Keywords: []string{"xyz", "category/cloud"},
Keywords: []string{"incus", "category/cloud"},
License: "Apache-2.0",
Homepage: "https://www.pulumi.com",
Repository: "https://github.com/pulumi/pulumi-xyz",
Repository: "https://github.com/brandonkal/pulumi-incus",
// The GitHub Org for the provider - defaults to `terraform-providers`. Note that this should
// match the TF provider module's require directive, not any replace directives.
GitHubOrg: "",
@@ -141,12 +141,12 @@ func Provider() tfbridge.ProviderInfo {
// Add any required configuration here, or remove the example below if
// no additional points are required.
"region": {
Type: "xyz:region/region:Region",
Type: "incus:region/region:Region",
},
},
// If extra types are needed for configuration, they can be added here.
ExtraTypes: map[string]schema.ComplexTypeSpec{
"xyz:region/region:Region": {
"incus:region/region:Region": {
ObjectTypeSpec: schema.ObjectTypeSpec{
Type: "string",
},
@@ -169,7 +169,7 @@ func Provider() tfbridge.ProviderInfo {
Golang: &tfbridge.GolangInfo{
// Set where the SDK is going to be published to.
ImportBasePath: path.Join(
"github.com/pulumi/pulumi-xyz/sdk/",
"github.com/brandonkal/pulumi-incus/sdk/",
tfbridge.GetModuleMajorVersion(version.Version),
"go",
mainPkg,
@@ -196,7 +196,7 @@ func Provider() tfbridge.ProviderInfo {
//
// You shouldn't need to override anything, but if you do, use the [tfbridge.ProviderInfo.Resources]
// and [tfbridge.ProviderInfo.DataSources].
prov.MustComputeTokens(tokens.SingleModule("xyz_", mainMod,
prov.MustComputeTokens(tokens.SingleModule("incus_", mainMod,
tokens.MakeStandard(mainPkg)))
prov.MustApplyAutoAliases()