straight-cartoon-24485
09/26/2023, 7:51 PMid := d.getId(model).ValueString()
This Terraform native provider seems to retrieve the id
just after the resource was created, when using Terraform only (on terraform apply
)
whereas Pulumi (wrapping the same terraform provider) seems to want to read the state of the world before the resource gets created, and so it blows up with:
error: openwrt:index/dhcpHost:DhcpHost resource 'testing' has a problem: Missing required property 'id': Name of the section. This name is only used when interacting with UCI directly.
I'm not sure who's wrong and who's right here. Is this a bug in the Pulumi Terraform Bridge, or a non-conventional design in the underlying terraform provider?terraform {
required_providers {
openwrt = {
source = "joneshf/openwrt"
}
}
}
provider "openwrt" {
hostname = "192.168.1.1"
username = "root"
password = var.openwrt_password
}
data "openwrt_system_system" "this" {
id = "cfg01e48a"
}
resource "openwrt_dhcp_host" "testing" {
id = "blah"
ip = "192.168.1.202"
mac = "12:34:56:78:90:ab"
name = "testing"
}
yet, the equivalent pulumi-wrapped version fails:
import * as pulumi from "@pulumi/pulumi";
import * as openwrt from "@deposition-cloud/pulumi-openwrt"
const openWrtProvider = new openwrt.Provider('openwrt', {
hostname: '192.168.1.1',
username: 'root',
scheme: 'http',
password: process.env.ROUTER_PASSWORD
})
const system = openwrt.getSystemSystem({
id: "cfg01e48a"
}, {
provider: openWrtProvider
} )
const ip = new openwrt.DhcpHost('testing', {
ip: '192.168.1.201',
mac: '12:23:34:45:56:67',
name: 'pulumi-openwrt-host'
}, {
id: "blah2",
provider: openWrtProvider
})
export const out = {
system
}
fails with:
Diagnostics:
openwrt:index:DhcpHost (testing):
error: problem getting dhcp. section: could not find section dhcp.
...because the resource to-be has yet tobe created on `pulumi up`(?)