From e667f7332a0b46d624d3e695fab2fb07bad865b9 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Tue, 16 Jul 2024 14:26:13 -0700 Subject: [PATCH] Apply ID type overrides Depends on pulumi/pulumi-terraform-bridge#2155. --- examples/record/csharp/MyStack.cs | 6 +++--- examples/record/py/__main__.py | 16 ++++++++++------ examples/record/ts/index.ts | 6 +++--- provider/resources.go | 13 +++++++++++++ 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/examples/record/csharp/MyStack.cs b/examples/record/csharp/MyStack.cs index 3cce0b9d..64733060 100644 --- a/examples/record/csharp/MyStack.cs +++ b/examples/record/csharp/MyStack.cs @@ -5,10 +5,10 @@ class MyStack : Stack { public MyStack() { - var record = new Record("test", new RecordArgs() + var record = new ZoneRecord("test", new ZoneRecordArgs() { - Ttl = "3600", - Domain = "stack72.dev", + Ttl = 3600, + ZoneName = "stack72.dev", Name = "test-csharp", Type = "A", Value = "192.168.0.1", diff --git a/examples/record/py/__main__.py b/examples/record/py/__main__.py index 8c83302c..bc4a0005 100644 --- a/examples/record/py/__main__.py +++ b/examples/record/py/__main__.py @@ -1,9 +1,13 @@ import pulumi import pulumi_dnsimple as dnsimple -foobar = dnsimple.Record("foobar", - domain="stack72.dev", - name="test-py", - ttl=3600, - type="A", - value="192.168.0.11") \ No newline at end of file +record = dnsimple.ZoneRecord( + "record", + zone_name="stack72.dev", + name="test-py", + ttl=3600, + type="A", + value="192.168.0.11", +) + +pulumi.export("record_urn", record.urn) diff --git a/examples/record/ts/index.ts b/examples/record/ts/index.ts index 84e9c48d..851e65ea 100644 --- a/examples/record/ts/index.ts +++ b/examples/record/ts/index.ts @@ -14,11 +14,11 @@ import * as dnsimple from "@pulumi/dnsimple"; -let record = new dnsimple.Record("test", { +let record = new dnsimple.ZoneRecord("test", { + zoneName: "stack72.dev", name: "test-ts", - domain: "stack72.dev", + value: "api.devflix.watch.herokudns.com", type: dnsimple.RecordTypes.CNAME, - value: "api.devflix.watch.herokudns.com" }); export default record.urn; diff --git a/provider/resources.go b/provider/resources.go index 8c38d6f4..1237e585 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -26,6 +26,7 @@ import ( pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" tfbridgetokens "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-dnsimple/provider/v3/pkg/version" ) @@ -100,6 +101,18 @@ func Provider() tfbridge.ProviderInfo { prov.MustComputeTokens(tfbridgetokens.SingleModule("dnsimple_", mainMod, tfbridgetokens.MakeStandard(mainPkg))) + + prov.P.ResourcesMap().Range(func(key string, value shim.Resource) bool { + if value.Schema().Get("id").Type() != shim.TypeString { + r := prov.Resources[key] + if r.Fields == nil { + r.Fields = make(map[string]*tfbridge.SchemaInfo, 1) + } + r.Fields["id"] = &tfbridge.SchemaInfo{Type: "string"} + } + return true + }) + prov.MustApplyAutoAliases() return prov