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

Update TF provider to v0.13.0, add upstream resources built with Terraform Plugin Framework #24

Open
wants to merge 1 commit 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
38 changes: 38 additions & 0 deletions provider/cmd/pulumi-resource-sentry/bridge-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"mux": {
"resources": {
"sentry:index/sentryAllProjectsSpikeProtection:SentryAllProjectsSpikeProtection": 1,
"sentry:index/sentryDashboard:SentryDashboard": 0,
"sentry:index/sentryIntegrationOpsgenie:SentryIntegrationOpsgenie": 1,
"sentry:index/sentryIntegrationPagerDuty:SentryIntegrationPagerDuty": 1,
"sentry:index/sentryIssueAlert:SentryIssueAlert": 1,
"sentry:index/sentryKey:SentryKey": 1,
"sentry:index/sentryMetricAlert:SentryMetricAlert": 0,
"sentry:index/sentryNotificationAction:SentryNotificationAction": 1,
"sentry:index/sentryOrganization:SentryOrganization": 0,
"sentry:index/sentryOrganizationCodeMapping:SentryOrganizationCodeMapping": 0,
"sentry:index/sentryOrganizationMember:SentryOrganizationMember": 0,
"sentry:index/sentryOrganizationRepositoryGithub:SentryOrganizationRepositoryGithub": 0,
"sentry:index/sentryPlugin:SentryPlugin": 0,
"sentry:index/sentryProject:SentryProject": 0,
"sentry:index/sentryProjectInboundDataFilter:SentryProjectInboundDataFilter": 1,
"sentry:index/sentryProjectSpikeProtection:SentryProjectSpikeProtection": 1,
"sentry:index/sentryProjectSymbolSource:SentryProjectSymbolSource": 1,
"sentry:index/sentryTeam:SentryTeam": 0,
"sentry:index/sentryTeamMember:SentryTeamMember": 1
},
"functions": {
"sentry:index/getSentryAllKeys:getSentryAllKeys": 1,
"sentry:index/getSentryAllProjects:getSentryAllProjects": 1,
"sentry:index/getSentryDashboard:getSentryDashboard": 0,
"sentry:index/getSentryIssueAlert:getSentryIssueAlert": 1,
"sentry:index/getSentryKey:getSentryKey": 1,
"sentry:index/getSentryMetricAlert:getSentryMetricAlert": 0,
"sentry:index/getSentryOrganization:getSentryOrganization": 0,
"sentry:index/getSentryOrganizationIntegration:getSentryOrganizationIntegration": 1,
"sentry:index/getSentryOrganizationMember:getSentryOrganizationMember": 1,
"sentry:index/getSentryProject:getSentryProject": 1,
"sentry:index/getSentryTeam:getSentryTeam": 0
}
}
}
2 changes: 1 addition & 1 deletion provider/cmd/pulumi-resource-sentry/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build ignore
//go:build ignore

package main

Expand Down
8 changes: 4 additions & 4 deletions provider/cmd/pulumi-resource-sentry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
package main

import (
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
"context"

"github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge"
sentry "github.com/pulumiverse/pulumi-sentry/provider"
"github.com/pulumiverse/pulumi-sentry/provider/pkg/version"
)

func main() {
// Modify the path to point to the new provider
tfbridge.Main("sentry", version.Version, sentry.Provider(), pulumiSchema)
tfbridge.MainWithMuxer(context.Background(), "sentry", sentry.Provider(), pulumiSchema)
}
1,900 changes: 1,386 additions & 514 deletions provider/cmd/pulumi-resource-sentry/schema.json

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions provider/cmd/pulumi-tfgen-sentry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ package main

import (
sentry "github.com/pulumiverse/pulumi-sentry/provider"
"github.com/pulumiverse/pulumi-sentry/provider/pkg/version"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
"github.com/pulumi/pulumi-terraform-bridge/pf/tfgen"
)

func main() {
// Modify the path to point to the new provider
tfgen.Main("sentry", version.Version, sentry.Provider())
tfgen.MainWithMuxer("sentry", sentry.Provider())
}
236 changes: 116 additions & 120 deletions provider/go.mod

Large diffs are not rendered by default.

1,206 changes: 1,019 additions & 187 deletions provider/go.sum

Large diffs are not rendered by default.

95 changes: 55 additions & 40 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@
package sentry

import (
// Allow embedding bridge-metadata.json in the provider.
"context"
_ "embed"

"fmt"
"path/filepath"

"github.com/jianyuan/terraform-provider-sentry/sentry"
provShim "github.com/jianyuan/terraform-provider-sentry/shim"
pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumiverse/pulumi-sentry/provider/pkg/version"
)

Expand All @@ -35,28 +38,19 @@ const (
mainMod = "index" // the sentry module
)

// preConfigureCallback is called before the providerConfigure function of the underlying provider.
// It should validate that the provider can be configured, and provide actionable errors in the case
// it cannot be. Configuration variables can be read from `vars` using the `stringValue` function -
// for example `stringValue(vars, "accessKey")`.
func preConfigureCallback(vars resource.PropertyMap, c shim.ResourceConfig) error {
return nil
}

// boolRef returns a reference to the bool argument.
func boolRef(b bool) *bool {
return &b
}
//go:embed cmd/pulumi-resource-sentry/bridge-metadata.json
var metadata []byte

// Provider returns additional overlaid schema and metadata associated with the provider..
func Provider() tfbridge.ProviderInfo {
// Instantiate the Terraform provider
p := shimv2.NewProvider(sentry.NewProvider(version.Version)())
p := pfbridge.MuxShimWithPF(context.Background(), shimv2.NewProvider(provShim.SDKProvider(version.Version)), provShim.PFProvider(version.Version))

// Create a Pulumi provider mapping
prov := tfbridge.ProviderInfo{
P: p,
Name: "sentry",
P: p,
Name: "sentry",
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
DisplayName: "Sentry",
Expand Down Expand Up @@ -84,7 +78,8 @@ func Provider() tfbridge.ProviderInfo {
Homepage: "https://github.com/pulumiverse",
Repository: "https://github.com/pulumiverse/pulumi-sentry",
// The GitHub Org for the provider - defaults to `terraform-providers`
GitHubOrg: "jianyuan",
GitHubOrg: "jianyuan",
MetadataInfo: tfbridge.NewProviderMetadata(metadata),
Config: map[string]*tfbridge.SchemaInfo{
// Add any required configuration here, or remove the example below if
// no additional points are required.
Expand All @@ -98,15 +93,14 @@ func Provider() tfbridge.ProviderInfo {
Default: &tfbridge.DefaultInfo{
EnvVars: []string{"SENTRY_TOKEN"},
},
Secret: boolRef(true),
Secret: tfbridge.True(),
},
"base_url": {
Default: &tfbridge.DefaultInfo{
EnvVars: []string{"SENTRY_BASE_URL"},
},
},
},
PreConfigureCallback: preConfigureCallback,
Resources: map[string]*tfbridge.ResourceInfo{
// Map each resource in the Terraform provider to a Pulumi type. Two examples
// are below - the single line form is the common case. The multi-line form is
Expand All @@ -120,42 +114,63 @@ func Provider() tfbridge.ProviderInfo {
// "tags": {Type: tfbridge.MakeType(mainPkg, "Tags")},
// },
// },

"sentry_all_projects_spike_protection": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryAllProjectsSpikeProtection")},
"sentry_dashboard": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryDashboard")},
"sentry_integration_opsgenie": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryIntegrationOpsgenie")},
"sentry_integration_pagerduty": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryIntegrationPagerDuty")},
"sentry_issue_alert": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryIssueAlert")},
"sentry_key": {
Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryKey"),
Fields: map[string]*tfbridge.SchemaInfo{
"dsn_secret": {Secret: boolRef(true)},
"secret": {Secret: boolRef(true)},
"dsn_secret": {Secret: tfbridge.True()},
"secret": {Secret: tfbridge.True()},
},
},
"sentry_organization": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganization")},
"sentry_organization_code_mapping": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganizationCodeMapping")},
"sentry_organization_member": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganizationMember")},
"sentry_metric_alert": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryMetricAlert")},
"sentry_notification_action": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryNotificationAction")},
"sentry_organization": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganization")},
"sentry_organization_code_mapping": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganizationCodeMapping")},
"sentry_organization_member": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganizationMember")},
"sentry_organization_repository_github": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryOrganizationRepositoryGithub")},
"sentry_project": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryProject")},
"sentry_plugin": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryPlugin")},
"sentry_rule": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryRule")},
"sentry_team": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryTeam")},
"sentry_dashboard": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryDashboard")},
"sentry_issue_alert": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryIssueAlert")},
"sentry_metric_alert": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryMetricAlert")},
"sentry_plugin": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryPlugin")},
"sentry_project": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryProject")},
"sentry_project_inbound_data_filter": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryProjectInboundDataFilter")},
"sentry_project_spike_protection": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryProjectSpikeProtection")},
"sentry_project_symbol_source": {
Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryProjectSymbolSource"),
Fields: map[string]*tfbridge.SchemaInfo{
"app_connect_private_key": {Secret: tfbridge.True()},
"password": {Secret: tfbridge.True()},
"private_key": {Secret: tfbridge.True()},
"secret_key": {Secret: tfbridge.True()},
},
},
"sentry_team": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryTeam")},
"sentry_team_member": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SentryTeamMember")},
},
DataSources: map[string]*tfbridge.DataSourceInfo{
// Map each resource in the Terraform provider to a Pulumi function. An example
// is below.
// "aws_ami": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getAmi")},

"sentry_all_keys": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryAllKeys")},
"sentry_all_projects": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryAllProjects")},
"sentry_dashboard": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryDashboard")},
"sentry_issue_alert": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryIssueAlert")},
"sentry_key": {
Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryKey"),
Fields: map[string]*tfbridge.SchemaInfo{
"dsn_secret": {Secret: boolRef(true)},
"secret": {Secret: boolRef(true)},
"dsn_secret": {Secret: tfbridge.True()},
"secret": {Secret: tfbridge.True()},
},
},
"sentry_organization": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryOrganization")},
"sentry_metric_alert": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryMetricAlert")},
"sentry_organization": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryOrganization")},
"sentry_organization_integration": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryOrganizationIntegration")},
"sentry_team": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryTeam")},
"sentry_dashboard": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryDashboard")},
"sentry_issue_alert": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryIssueAlert")},
"sentry_metric_alert": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryMetricAlert")},
"sentry_organization_member": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryOrganizationMember")},
"sentry_project": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryProject")},
"sentry_team": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSentryTeam")},
},
JavaScript: &tfbridge.JavaScriptInfo{
PackageName: "@pulumiverse/sentry",
Expand Down
52 changes: 52 additions & 0 deletions provider/shim/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module github.com/jianyuan/terraform-provider-sentry/shim

go 1.22.3

require (
github.com/hashicorp/terraform-plugin-framework v1.8.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/jianyuan/terraform-provider-sentry v0.13.0
)

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.6 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/jianyuan/go-sentry/v2 v2.8.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/peterhellberg/link v1.2.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.20.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.34.0 // indirect
)
Loading