after a fair bit of time looking into the CORS que...
# getting-started
n
after a fair bit of time looking into the CORS question - I have to say that I don't understand why this is so poorly supported in Pulumi. Coming from serverless framework where you just specify allowed origins, methods and headers, I don't get why it's effectively not supported as a thing in Pulumi and you effectively have to dig into the low level implementation of the OPTIONS request to make it work. Hopefully I'm missing something, because it feels like I'm writing heaps of boilerplate for something which should take 5 or 6 lines.
f
All the non-terraform pulumi resources are level 1, i.e. a wrapper around the raw API call. I build level 2 or 3 wrappers around those to make it reasonable to use. If level one is a azure storage account or s3 bucket, level 2 would be a secure storage and level 3 would be multiple resources, like everything you need for a container running with storage. It would be amazing to see some community level 2 and 3 resources that helps speed up development when following standard patterns.
n
This is why I didn't want to use terraform itself - it approaches the problem from an infrastructure/ops rather than developer mindset. I was hoping, given the code-oriented approach, that this wouldn't be the case with Pulumi, but it would seem that the terraform mindset still prevails. If I have the capacity, I may try to add an abstracted CORS feature to aws-apigateway, but I have so many other things to do first. :-/
f
I spend quite a bit of my time to write higher level wrappers to make it feel more like writing code and less like raw resources. Plenty of semantics to argue about, and the api is so so, but it is a step up.
Copy code
var grafana = builder.ContainerGroupBuilder("grafana")
    .WithOsType(ContainerOsType.Linux)
    .WithSku(ContainerInstanceSkuName.Standard)
    .WithVolume(grafanaFileShareName, grafanaSa)
    .WithHealthCheckPath("/robots.txt")
    .ContainerBuilder("grafana", "grafana/grafana:11.0.0")
        .WithPort(Port.Custom(3000), ContainerProtocol.TCP)
        .WithMount(grafanaFileShareName, "/var/lib/grafana")
        .WithResources(cpu: 1, memoryInGb: 2)
        .Done()
    .Build()