This message was deleted.
s
This message was deleted.
l
ended up writing my own provider to solve this issue. If there is any better solutions. Let me know
s
You can use the Command provider and set
dependsOn
to the last thing to be provisioned. https://www.pulumi.com/registry/packages/command/api-docs/local/command/
👍 1
l
writing multiline strings with command is a bit iffy tho. unless there is something i missed?
s
Hmm. Maybe the Automation API would be a better fit?
l
might be... But like. How would one write a kubeconfig etc to local file system? Just to give a random example of a local file that depends on cloud resources
s
pulumi stack output kubeconfig --show-secrets > kubeconfig.yaml
l
ah. manual step. gotcha
s
BUT, if you're using the Pulumi K8s provider, you can just feed it into the provider (this is C# and AKS, but you should be able to translate for your lang/cloud):
Copy code
var creds = AzureNative.ContainerService.ListManagedClusterUserCredentials.Invoke(new() {
    ResourceGroupName = resourceGroup.Name,
    ResourceName = managedCluster.Name,
});
var encoded = creds.Apply(result => result.Kubeconfigs[0]!.Value);
var decoded = encoded.Apply(enc => {
    var bytes = Convert.FromBase64String(enc);
    return Encoding.UTF8.GetString(bytes);
});

var provider = new Provider("k8s", new ProviderArgs {
  KubeConfig = decoded
});

// create K8s resources here
If you want to orchestrate, you could use Make for sure.
l
Yeah. Just using kubeconfig as an example. Make as in? Makefile?
s
Yeah. You can automate the commands to run after
pulumi up
l
ah gotcha!
s
You will need to use a pseudotarget since
pulumi up
does not create a file, but you could do something like
pulumi up -y && touch .make/pulumiup
or just use
.PHONY
and run
pulumi up
every time.
l
I assume outputs can store arrays?
s
Yes. You can do
Output<string[]>
or
Output<string>[]
. I believe the former is preferred.
b
@lively-pizza-96645 I copy this design but don't use the k8 provider but it might have examples of what you're looking for https://github.com/gitfool/Pulumi.Dungeon
361 Views