sparse-intern-71089
06/10/2020, 5:46 PMnice-airport-15607
06/10/2020, 5:50 PMprotocol
of lambda
and trying to set the endpoint
to the arn of my lambda, but i get
error: Error creating SNS topic: InvalidParameter: Invalid parameter: Lambda endpoint ARN
status code: 400, request id: bb8ed901-7c38-5ff9-af43-8e5a64cecebf
nice-airport-15607
06/10/2020, 5:52 PMnice-airport-15607
06/10/2020, 6:16 PMconst topic = pulumi.output(aws.sns.getTopic({
name: 'topic-name'
}, { async: true }))
but now I’m getting the following error on
new aws.sns.TopicSubscription
of
Type 'Output<string>' is not assignable to type 'Input<Topic>'.
even though it says to use an arn
/**
* The ARN of the SNS topic to subscribe to
*/
readonly topic: pulumi.Input<Topic>;
white-balloon-205
topic
variable isn’t not a string. It will be some object with a property on it that is a string.white-balloon-205
nice-airport-15607
06/11/2020, 3:52 AMconst topic = new aws.sns.Topic('someTopic')
export const lambdaWithSns = new aws.lambda.Permission('lambdaWithSns', {
action: 'lambda:InvokeFunction',
function: someLambda.name,
principal: '<http://sns.amazonaws.com|sns.amazonaws.com>',
sourceArn: topic.arn
})
export const subscriptionChange = new aws.sns.TopicSubscription(resourceName(pulumi, 'subscription'), {
protocol: 'lambda',
topic: topic,
endpoint: someLambda.arn
})
nice-airport-15607
06/16/2020, 5:03 PMtopic
in production env, and now it created a duplicate topic-2468
& topic-1357
, but i’d want the one that was already created, and NOT create a new one. That’s why i was trying use getTopic
, but that doesn’t have the same return type, so back to the drawing board. thx though.white-balloon-205
Topic.get
to get a full instance of Topic
based on an existing ID.
https://www.pulumi.com/docs/reference/pkg/aws/sns/topic/#look-upnice-airport-15607
06/16/2020, 5:47 PM/**
* Get an existing Topic resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TopicState, opts?: pulumi.CustomResourceOptions): Topic;
I feel like i’ve tried that ☝️ but i was failing with it also. ill look again, thx @white-balloon-205 appreciate it.nice-airport-15607
06/16/2020, 6:57 PMconst existingTopic = pulumi.output(aws.sns.Topic.get('someTopic', '3ce3de0'))
const arn = existingTopic.apply(o => o.arn)
and that results with:
arn OutputImpl {
__pulumiOutput: true,
isKnown: Promise { <pending> },
isSecret: Promise { <pending> },
resources: [Function],
allResources: [Function],
promise: [Function],
toString: [Function],
toJSON: [Function] }
and i still can’t seem to get the Topic.arn
, am i missing something?nice-airport-15607
06/16/2020, 7:17 PMTo get the value of an Output<T> as an Output<string> consider either:
1: o.apply(v => `prefix${v}suffix`)
2: pulumi.interpolate `prefix${v}suffix`
See <https://pulumi.io/help/outputs> for more details.
This function may throw in a future version of @pulumi/pulumi.
white-balloon-205
arn
- but the code above should just be:
const arn = aws.sns.Topic.get('someTopic', '3ce3de0').arn
nice-airport-15607
06/16/2020, 10:16 PMexport const pxTopicSubLambdaWithSns = new aws.lambda.Permission('pxTopicSubLambdaWithSns', {
action: 'lambda:InvokeFunction',
function: pxTopicSubLambda.name,
principal: '<http://sns.amazonaws.com|sns.amazonaws.com>',
sourceArn: topicArn
})
nice-airport-15607
06/16/2020, 10:16 PMnice-airport-15607
06/16/2020, 10:17 PMerror: Preview failed: refreshing urn:pulumi:::aws:sns/topic:Topic::deviceConfigUpdates: InvalidParameter: Invalid parameter: TopicArn Reason: An ARN must have at least 6 elements, not 1
status code: 400, request id: 6fc026ce-bed4-5b7a-8538-71adf830afb3