I'm learning about ComponentResources my code: <h...
# python
g
I'm learning about ComponentResources my code: https://gist.github.com/1oglop1/c563f25b317ecd6149e5465bd9eea597 And I'm trying to understand how
register_outputs
should work with secrets
opts=ResourceOptions(additional_secret_outputs=['password'])
The result of the code above is this for both the
First
and the
Second
component. I'm probably doing something wrong that the
password
is not marked as a secret value in resource outputs. here is the result of
pulumi stack export
Copy code
{
    "version": 3,
        "resources": [
            {
                "urn": "urn:pulumi:dev::tests::pulumi:pulumi:Stack::tests-dev",
                "custom": false,
                "type": "pulumi:pulumi:Stack"
            },
            {
                "urn": "urn:pulumi:dev::tests::custom:first::first",
                "custom": false,
                "type": "custom:first",
                "outputs": {
                    "password": "222222",
                    "w2": "222222"
                },
                "parent": "urn:pulumi:dev::tests::pulumi:pulumi:Stack::tests-dev",
                "additionalSecretOutputs": [
                    "password"
                ]
            },
            {
                "urn": "urn:pulumi:dev::tests::custom:second::second",
                "custom": false,
                "type": "custom:second",
                "outputs": {
                    "password": "Secret"
                },
                "parent": "urn:pulumi:dev::tests::pulumi:pulumi:Stack::tests-dev",
                "additionalSecretOutputs": [
                    "password"
                ]
            }
        ]
    }
}
b
@great-sunset-355 you need to make the output on the resource inside the Component a secret, so set
additional_secret_outputs
on the resource itself, not on the component. See here: https://github.com/pulumi/examples/blob/ca40203279f393c0c159dadcadc97c6007122997/aws-py-assume-role/create-role/__main__.py#L40
g
Does it mean on the instance of the resource? Because the values I tried to hide were not from pulumi resources but my own.
b
what do you mean "your own" ?
g
https://gist.github.com/1oglop1/c563f25b317ecd6149e5465bd9eea597#file-__main__-py-L13 this value returned by the function later on converted to
Output
b
i'm not super familiar with what you're doing here I'm afraid, it doesn't look like you're constructing a proper resource there, you'd need a dynamic provider or something
g
I was just experimenting with custom resources and tried to randomly add an Output object to see if it works the way I'd expect because I did not see it thoroughly documented. I assume for it to work I'd need to add actual resources like here. https://github.com/pulumi/examples/blob/258d3bad0a00020704743e37911c51be63c06bb4/kubernetes-py-jenkins/jenkins.py#L214