Skip to content

Commit

Permalink
Apply ID type overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
iwahbe committed Jul 17, 2024
1 parent 3e0b7b1 commit e667f73
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
6 changes: 3 additions & 3 deletions examples/record/csharp/MyStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 10 additions & 6 deletions examples/record/py/__main__.py
Original file line number Diff line number Diff line change
@@ -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")
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)
6 changes: 3 additions & 3 deletions examples/record/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 13 additions & 0 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e667f73

Please sign in to comment.