https://pulumi.com logo
#getting-started
Title
# getting-started
m

many-yak-61188

09/17/2021, 11:15 AM
👋 question on pulumi secrets & outout. I've an API key which I am saving as a secret that I need to pass into a ecs task definition as a
string
within
options
for
logConfiguration
. Unlike the
require
method which return the raw type the
requireSecret
method returns an
Output<string>
type. I noticed a similar requirement for passing in
environments
in handled by specifying a type of
pulumi.Input<KeyValuePair[]>
where as
LogConfigurations.options
has the type
[key: string]: string;
Can I use an
Output
type with
LogConfigurations.options
?
p

prehistoric-activity-61023

09/17/2021, 11:28 AM
usually, you’re gonna have issues if you try to pass
Output<X>
to functions that do not expect
Input<X>
Output<X>
is a wrapper for type
X
and it’s necessary because the value might not be available at the beginning (because for example it comes from other cloud resources created dynamically)
can you share some reference what resource you’re talking about?
I’ve found https://www.pulumi.com/docs/reference/pkg/aws/ecs/taskdefinition/ but there’s nothing called
logConfiguration
.
so it’s possible you will need to generate
logConfiguration
value using pulumi
apply
function
assuming you have
Output<string>
called
mySecret
you should write (treat it as a hint and not a working example - I usually use python with pulumi):
Copy code
...
logConfiguration: mySecret.apply(s => {
  foo: "bar",
  options: s
}),
instead of:
Copy code
...
logConfiguration: {
  foo: "bar",
  options: mySecret
},
m

many-yak-61188

09/18/2021, 1:03 PM
thanks for the response @prehistoric-activity-61023. The suggested change worked
🙌 1
sorry for the delayed response I didn't notice it earlier
3 Views