How does Pulumi's lifecycle differ from Terraform'...
# package-authoring
How does Pulumi's lifecycle differ from Terraform's? this line:
Copy code
id := d.getId(model).ValueString()
This Terraform native provider seems to retrieve the
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:
Copy code
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?
this terraform code works:
Copy code
terraform {
  required_providers {
    openwrt = {
      source  = "joneshf/openwrt"

provider "openwrt" {
  hostname = ""
  username = "root"
  password = var.openwrt_password

data "openwrt_system_system" "this" {
  id = "cfg01e48a"

resource "openwrt_dhcp_host" "testing" {
  id = "blah"
  ip   = ""
  mac  = "12:34:56:78:90:ab"
  name = "testing"
yet, the equivalent pulumi-wrapped version fails:
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as openwrt from "@deposition-cloud/pulumi-openwrt"

const openWrtProvider = new openwrt.Provider('openwrt', {
  hostname: '',
  username: 'root',
  scheme: 'http',
  password: process.env.ROUTER_PASSWORD

const system = openwrt.getSystemSystem({
  id: "cfg01e48a"
}, {
  provider: openWrtProvider
} )

const ip = new openwrt.DhcpHost('testing', {
  ip: '',
  mac: '12:23:34:45:56:67',
  name: 'pulumi-openwrt-host'
}, {
  id: "blah2",
  provider: openWrtProvider

export const out = {
fails with:
Copy code
  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`(?)