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

repro for 2803 #2806

Draft
wants to merge 2 commits into
base: vvm/add_to_provider_info_helper
Choose a base branch
from
Draft
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
20 changes: 20 additions & 0 deletions pkg/pf/internal/providerbuilder/build_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge"
tfbridge0 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
)

// Provider is a test provider that can be used in tests.
Expand Down Expand Up @@ -81,6 +85,22 @@ func (impl *Provider) GRPCProvider() tfprotov6.ProviderServer {
return providerserver.NewProtocol6(impl)()
}

func (impl *Provider) ToProviderInfo() tfbridge0.ProviderInfo {
shimProvider := tfbridge.ShimProvider(impl)

provider := tfbridge0.ProviderInfo{
P: shimProvider,
Name: impl.TypeName,
Version: "0.0.1",
MetadataInfo: &tfbridge0.MetadataInfo{},
EnableAccurateBridgePreview: true,
}

provider.MustComputeTokens(tokens.SingleModule(impl.TypeName, "index", tokens.MakeStandard(impl.TypeName)))

return provider
}

type NewProviderArgs struct {
TypeName string
Version string
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "testprovider",
"version": "0.0.1",
"attribution": "This Pulumi package is based on the [`testprovider` Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider).",
"meta": {
"moduleFormat": "(.*)(?:/[^/]*)"
},
"language": {
"nodejs": {
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-testprovider` repo](https://github.com/terraform-providers/terraform-provider-testprovider/issues).",
"compatibility": "tfbridge20",
"disableUnionOutputTypes": true
},
"python": {
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-testprovider` repo](https://github.com/terraform-providers/terraform-provider-testprovider/issues).",
"compatibility": "tfbridge20",
"pyproject": {}
}
},
"config": {},
"types": {
"testprovider:index/getAttrResCollection1:getAttrResCollection1": {
"properties": {
"prop": {
"type": "string"
}
},
"type": "object"
},
"testprovider:index/getBlockResCollection1:getBlockResCollection1": {
"properties": {
"prop1": {
"type": "string"
}
},
"type": "object"
}
},
"provider": {
"description": "The provider type for the testprovider package. By default, resources use package-wide configuration\nsettings, however an explicit `Provider` instance may be created and passed during resource\nconstruction to achieve fine-grained programmatic control over provider settings. See the\n[documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.\n"
},
"functions": {
"testprovider:index/getAttrRes:getAttrRes": {
"outputs": {
"description": "A collection of values returned by getAttrRes.\n",
"properties": {
"collection1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getAttrResCollection1:getAttrResCollection1"
}
},
"id": {
"type": "string"
}
},
"type": "object",
"required": [
"collection1",
"id"
]
}
},
"testprovider:index/getBlockRes:getBlockRes": {
"inputs": {
"description": "A collection of arguments for invoking getBlockRes.\n",
"properties": {
"collection1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getBlockResCollection1:getBlockResCollection1"
}
}
},
"type": "object"
},
"outputs": {
"description": "A collection of values returned by getBlockRes.\n",
"properties": {
"collection1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getBlockResCollection1:getBlockResCollection1"
}
},
"id": {
"type": "string"
}
},
"type": "object",
"required": [
"id"
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"name": "testprovider",
"version": "0.0.1",
"attribution": "This Pulumi package is based on the [`testprovider` Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider).",
"meta": {
"moduleFormat": "(.*)(?:/[^/]*)"
},
"language": {
"nodejs": {
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-testprovider` repo](https://github.com/terraform-providers/terraform-provider-testprovider/issues).",
"compatibility": "tfbridge20",
"disableUnionOutputTypes": true
},
"python": {
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-testprovider` repo](https://github.com/terraform-providers/terraform-provider-testprovider/issues).",
"compatibility": "tfbridge20",
"pyproject": {}
}
},
"config": {},
"types": {
"testprovider:index/getServingEndpointsEndpoints1:getServingEndpointsEndpoints1": {
"properties": {
"aiGateways": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1AiGateway:getServingEndpointsEndpoints1AiGateway"
}
}
},
"type": "object",
"required": [
"aiGateways"
],
"language": {
"nodejs": {
"requiredInputs": []
}
}
},
"testprovider:index/getServingEndpointsEndpoints1AiGateway:getServingEndpointsEndpoints1AiGateway": {
"properties": {
"guardrails": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1AiGatewayGuardrail:getServingEndpointsEndpoints1AiGatewayGuardrail"
}
}
},
"type": "object",
"required": [
"guardrails"
],
"language": {
"nodejs": {
"requiredInputs": []
}
}
},
"testprovider:index/getServingEndpointsEndpoints1AiGatewayGuardrail:getServingEndpointsEndpoints1AiGatewayGuardrail": {
"properties": {
"inputs": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1AiGatewayGuardrailInput:getServingEndpointsEndpoints1AiGatewayGuardrailInput"
}
}
},
"type": "object",
"required": [
"inputs"
],
"language": {
"nodejs": {
"requiredInputs": []
}
}
},
"testprovider:index/getServingEndpointsEndpoints1AiGatewayGuardrailInput:getServingEndpointsEndpoints1AiGatewayGuardrailInput": {
"properties": {
"maxBatchSize": {
"type": "integer"
}
},
"type": "object",
"required": [
"maxBatchSize"
],
"language": {
"nodejs": {
"requiredInputs": []
}
}
}
},
"provider": {
"description": "The provider type for the testprovider package. By default, resources use package-wide configuration\nsettings, however an explicit `Provider` instance may be created and passed during resource\nconstruction to achieve fine-grained programmatic control over provider settings. See the\n[documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.\n"
},
"functions": {
"testprovider:index/getServingEndpoints:getServingEndpoints": {
"outputs": {
"description": "A collection of values returned by getServingEndpoints.\n",
"properties": {
"endpoints1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1:getServingEndpointsEndpoints1"
}
},
"id": {
"type": "string",
"description": "The provider-assigned unique ID for this managed resource.\n"
}
},
"type": "object",
"required": [
"endpoints1",
"id"
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"name": "testprovider",
"version": "0.0.1",
"attribution": "This Pulumi package is based on the [`testprovider` Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider).",
"meta": {
"moduleFormat": "(.*)(?:/[^/]*)"
},
"language": {
"nodejs": {
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-testprovider` repo](https://github.com/terraform-providers/terraform-provider-testprovider/issues).",
"compatibility": "tfbridge20",
"disableUnionOutputTypes": true
},
"python": {
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-testprovider)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e please consult the source [`terraform-provider-testprovider` repo](https://github.com/terraform-providers/terraform-provider-testprovider/issues).",
"compatibility": "tfbridge20",
"pyproject": {}
}
},
"config": {},
"types": {
"testprovider:index/getServingEndpointsEndpoints1:getServingEndpointsEndpoints1": {
"properties": {
"aiGateway1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1AiGateway1:getServingEndpointsEndpoints1AiGateway1"
}
}
},
"type": "object"
},
"testprovider:index/getServingEndpointsEndpoints1AiGateway1:getServingEndpointsEndpoints1AiGateway1": {
"properties": {
"guardrails1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1AiGateway1Guardrails1:getServingEndpointsEndpoints1AiGateway1Guardrails1"
}
}
},
"type": "object"
},
"testprovider:index/getServingEndpointsEndpoints1AiGateway1Guardrails1:getServingEndpointsEndpoints1AiGateway1Guardrails1": {
"properties": {
"input1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1AiGateway1Guardrails1Input1:getServingEndpointsEndpoints1AiGateway1Guardrails1Input1"
}
}
},
"type": "object"
},
"testprovider:index/getServingEndpointsEndpoints1AiGateway1Guardrails1Input1:getServingEndpointsEndpoints1AiGateway1Guardrails1Input1": {
"properties": {
"maxBatchSize": {
"type": "integer",
"language": {
"csharp": {
"name": "MaxBatchSize1"
}
}
}
},
"type": "object",
"required": [
"maxBatchSize"
]
}
},
"provider": {
"description": "The provider type for the testprovider package. By default, resources use package-wide configuration\nsettings, however an explicit `Provider` instance may be created and passed during resource\nconstruction to achieve fine-grained programmatic control over provider settings. See the\n[documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.\n"
},
"functions": {
"testprovider:index/getServingEndpoints:getServingEndpoints": {
"inputs": {
"description": "A collection of arguments for invoking getServingEndpoints.\n",
"properties": {
"endpoints1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1:getServingEndpointsEndpoints1"
}
}
},
"type": "object"
},
"outputs": {
"description": "A collection of values returned by getServingEndpoints.\n",
"properties": {
"endpoints1": {
"type": "array",
"items": {
"$ref": "#/types/testprovider:index/getServingEndpointsEndpoints1:getServingEndpointsEndpoints1"
}
},
"id": {
"type": "string",
"description": "The provider-assigned unique ID for this managed resource.\n"
}
},
"type": "object",
"required": [
"id"
]
}
}
}
}
Loading
Loading