Skip to content
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

create pulumi plugin crane #7005

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ yarn.lock


.venv
.aider*
.env
Submodule .devcontainer updated from 000000 to dce1e3
14 changes: 14 additions & 0 deletions go/pulumi/plugin/crane/provider/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "provider_lib",
srcs = ["main.go"],
deps = [
"@com_github_pulumi_pulumi//sdk/v3/go/pulumi",
],
)

go_binary(
name = "provider",
embed = [":provider_lib"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2016-2023, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
p "github.com/pulumi/pulumi-go-provider"

crane "github.com/pulumi/pulumi-crane/provider"
)

// Serve the provider against Pulumi's Provider protocol.
func main() { p.RunProvider(xyz.Name, xyz.Version, xyz.Provider()) }
11 changes: 11 additions & 0 deletions go/pulumi/plugin/crane/provider/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/zemn-me/monorepo/go/pulumi/plugin/crane/provider

go 1.22

require (
github.com/blang/semver v3.5.1+incompatible
github.com/pulumi/pulumi-go-provider v0.23.0
github.com/pulumi/pulumi-random/sdk/v4 v4.16.7
github.com/pulumi/pulumi/sdk/v3 v3.136.1
github.com/stretchr/testify v1.9.0
)
10 changes: 10 additions & 0 deletions go/pulumi/plugin/crane/provider/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package main

import (
p "github.com/pulumi/pulumi-go-provider"
"github.com/pulumi/pulumi-xyz/provider"
)

func main() {
p.RunProvider(provider.Name, provider.Version, provider.Provider())
}
66 changes: 66 additions & 0 deletions go/pulumi/provider/something/provider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2016-2023, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package provider

import (
p "github.com/pulumi/pulumi-go-provider"
"github.com/pulumi/pulumi-go-provider/infer"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
)

// Version is initialized by the Go linker to contain the semver of this build.
var Version string

const Name string = "xyz"

func Provider() p.Provider {
// We tell the provider what resources it needs to support.
// In this case, a single resource and component
return infer.Provider(infer.Options{
Resources: []infer.InferredResource{
infer.Resource[Random, RandomArgs, RandomState](),
},
Resources: []infer.InferredResource{
infer.Resource[CraneImage, CraneImageArgs, CraneImageState](),
},
Components: []infer.InferredComponent{
infer.Component[*RandomComponent, RandomComponentArgs, *RandomComponentState](),
},
Config: infer.Config[Config](),
ModuleMap: map[tokens.ModuleName]tokens.ModuleName{
"provider": "index",
},
})
}

// CraneImage represents a resource for uploading an OCI image to ECR using Crane.
type CraneImage struct{}

// CraneImageArgs are the input arguments for creating a CraneImage resource.
type CraneImageArgs struct {
ImagePath string `pulumi:"imagePath"`
Repository string `pulumi:"repository"`
Tag string `pulumi:"tag"`
}

// CraneImageState is the state of a CraneImage resource.
type CraneImageState struct {
ImageDigest string `pulumi:"imageDigest"`
}

// Define some provider-level configuration
type Config struct {
Scream *bool `pulumi:"itsasecret,optional"`
}
105 changes: 0 additions & 105 deletions third_party/pulumi-component-provider-boilerplate/provider/go.mod

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
"dist",
"external"
]
}
}