Is there any way to export all the registered outp...
# golang
m
Is there any way to export all the registered outputs of a component resource in golang? I'm hoping I'm just missing something, as I really like just exporting a resource and seeing all of it's fields coming from typescript world
m
I mean, you could simply do
ctx.Export("name", structName)
, but I would not recommend exporting everything as a way of debugging. Generally, once you have this information it has already been applied to your cloud provider and “works”.
m
Thank you for responding! Not sure why slack didn't notify me, so sorry for late response on my part Actually doing that does not seem to work. This is what I see when I do that
Copy code
{
  "4dabf18193072939515e22adb298388d": "5cf8f73096256a8f31e491e813e4eb8e",
  "packageVersion": "",
  "urn": "urn:pulumi:dev::{project}::infra-pulumi-pkgs:externalS3Bucket:WithUser::{project}-dev-external-s3-bucket"
}
It's got like the urn, but none of the actual information I would want to see, i.e. vpcs in a cluster, s3 bucket arn, aws access key id for component resources containing those things. This is useful for more than just debugging, as it makes it a lot easier to get stack references. For example if you want to get any of the things above, or you just forgot that you wanted something in the outputs to stack reference, if you export all the values you don't have to go back and redeploy the initial stack because you've already got all the values you could possibly want available in the outputs. Pulumi takes care of making sure that secrets aren't shown, so I don't believe this is a security risk
m
No worries, I was not the one needing help 😄 I don’t know why you aren’t seeing all the information since I have no idea what you are exporting here. However, on teams I have been a part of, we prefer not to export everything, but only whats valuable (and generally that would be the part of a resources necessary for us to consume it elsewhere — ID, name or ARN comes to mind).
m
Ah. In this case it's a component resource composed of an s3 bucket, a user, and an aws key. More generally though we plan to create a number of component resources encapsulating what we've decided our best practices or higher order concepts (like an s3 bucket for an external partner with a user they can use here). I've registered the resource outputs in the component resource, which I thought would cause the (non-secret) values to be shown as the outputs when I exported the componentresource itself. So if we decided that we only wanted to export certain things from the component resource (i.e. bucket arn, etc) then I would expect those things to show up when we do the next level up export rather than having to reach into the component resource and essentially declare the necessary pieces of information again.
Copy code
if err := ctx.RegisterResourceOutputs(esb, pulumi.Map{
		"bucket":     bucket,
		"user":       user,
		"access_key": accessKey,
	}); err != nil {
		return nil, err
	}