shantanuo
shantanuo

Reputation: 32336

store the values to a variable after executing the template

This cloudformation template is working as expected:

https://github.com/shantanuo/cloudformation/blob/master/updated/esbck.yml

But how do I output the ARN of IAM role that it creates?

Upvotes: 0

Views: 186

Answers (2)

maafk
maafk

Reputation: 6876

To add to Marcins answer, if you export the output, it becomes available for use in other Cloudformation templates deployed in the same AWS account (in the same region)

Add an export to the output:

Outputs:
  RoleArn:
    Value: !GetAtt EsSnapshotRole.Arn
    Export:
      Name: EsSnapshotRoleArn

Once this is done, you can use the Fn::ImportValue intrinsic function in other templates

# some-other-template.yml

Resources:
  SomeResourceRequiringRoleArn:
    Type: AWS::SomeService::SomeResource
    Properties:
      IamRoleArn: !ImportValue EsSnapshotRoleArn

Upvotes: 2

Marcin
Marcin

Reputation: 238299

Have to add output section:

Outputs:

  RoleArn:
     Value: !GetAtt EsSnapshotRole.Arn

Upvotes: 1

Related Questions