https://pulumi.com logo
Title
q

quick-king-51158

05/04/2023, 10:34 AM
hi guys, is pulumi supports wait for fields (with timeouts) like terraform?
resource "kubernetes_manifest" "foo_mci" {
  provider   = ...
  depends_on = ...
  manifest = { ... }
  wait {
    fields = {
      # check ingress has an IP
      "<http://status.VIP|status.VIP>" = "^(\\d+(\\.|$)){4}"
    }
  }
  timeouts {
    create = "5m"
    update = "5m"
    delete = "1m"
  }
}
c

cuddly-computer-18851

05/04/2023, 11:55 AM
async behaviour like that is what pulumi Outputs achieve.
r

rich-motorcycle-3089

05/04/2023, 3:32 PM
If you have resources getting created before dependent objects are ready you could be missing the use of dependsOn fields. Also, since Pulumi is just a programming language, it’s reasonable to think you could create a timeout component if you really needed one using dependsOn and the language’s sleep function. Here’s an example of dependsOn in Go. I can’t create my IAM role until the service is created. Pulumi will automatically control this timing for me by defining dependencies.
using-depends-on.go
q

quick-king-51158

05/04/2023, 3:47 PM
thanks, dependsOn is fine, however my case is a bit trickier.. i create a kubernetes crd (gke multi cluster ingress), which gets created fine, then i need to wait till gke assign an ip address to the resource.. it’s nice terraform can wait for specific fields to be available..
in case of pulumi it looks then i need create a custom solution for this.
r

rich-motorcycle-3089

05/04/2023, 6:01 PM
Does your crd object have an IP address field available? Usually Pulumi has these available in the form of StringOutput. Then you can attach an
.apply
block to it to indicate to Pulumi that you need that field for something before it can proceed. I’m thinking something like
const ingressAddress = crd.publicIpAddress.apply(
  (address) => MyCustomIngressAddressResource(address)
);

const nextComponent = TheNextComponent(
  ...,
  {
    dependsOn: [ingressAddress]
  }
);
CleanShot 2023-05-04 at 11.01.47.png
I said “object URIs” by mistake. I’m just saving the objects
q

quick-king-51158

05/04/2023, 7:11 PM
ok, i will check this, thanks