How to use importValue and join in Cloudformation
up vote
0
down vote
favorite
I have a stack which depends on a value which is exported in a different stack (value is supertest
)
I try to use it as below
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", !ImportValue: !Sub "supertest-${Environment}" ] ]
But I got a syntax error while this works (hardcoding the supertest value)
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", "lol-dev" ] ]
amazon-web-services amazon-cloudformation
add a comment |
up vote
0
down vote
favorite
I have a stack which depends on a value which is exported in a different stack (value is supertest
)
I try to use it as below
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", !ImportValue: !Sub "supertest-${Environment}" ] ]
But I got a syntax error while this works (hardcoding the supertest value)
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", "lol-dev" ] ]
amazon-web-services amazon-cloudformation
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a stack which depends on a value which is exported in a different stack (value is supertest
)
I try to use it as below
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", !ImportValue: !Sub "supertest-${Environment}" ] ]
But I got a syntax error while this works (hardcoding the supertest value)
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", "lol-dev" ] ]
amazon-web-services amazon-cloudformation
I have a stack which depends on a value which is exported in a different stack (value is supertest
)
I try to use it as below
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", !ImportValue: !Sub "supertest-${Environment}" ] ]
But I got a syntax error while this works (hardcoding the supertest value)
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", "lol-dev" ] ]
amazon-web-services amazon-cloudformation
amazon-web-services amazon-cloudformation
asked Nov 8 at 8:21
mealesbia
386
386
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
I believe that syntax is not valid.
Try this:
OriginAccessIdentity:
Fn::Join:
- ""
- - "origin-access-identity/cloudfront/"
- Fn::ImportValue: !Sub "supertest-${Environment}"
Here is another example where i use it similarly: https://github.com/faermanj/Sitting-Ducks/blob/master/cfn-beanstalk-env.yml
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
I believe that syntax is not valid.
Try this:
OriginAccessIdentity:
Fn::Join:
- ""
- - "origin-access-identity/cloudfront/"
- Fn::ImportValue: !Sub "supertest-${Environment}"
Here is another example where i use it similarly: https://github.com/faermanj/Sitting-Ducks/blob/master/cfn-beanstalk-env.yml
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
add a comment |
up vote
1
down vote
accepted
I believe that syntax is not valid.
Try this:
OriginAccessIdentity:
Fn::Join:
- ""
- - "origin-access-identity/cloudfront/"
- Fn::ImportValue: !Sub "supertest-${Environment}"
Here is another example where i use it similarly: https://github.com/faermanj/Sitting-Ducks/blob/master/cfn-beanstalk-env.yml
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
I believe that syntax is not valid.
Try this:
OriginAccessIdentity:
Fn::Join:
- ""
- - "origin-access-identity/cloudfront/"
- Fn::ImportValue: !Sub "supertest-${Environment}"
Here is another example where i use it similarly: https://github.com/faermanj/Sitting-Ducks/blob/master/cfn-beanstalk-env.yml
I believe that syntax is not valid.
Try this:
OriginAccessIdentity:
Fn::Join:
- ""
- - "origin-access-identity/cloudfront/"
- Fn::ImportValue: !Sub "supertest-${Environment}"
Here is another example where i use it similarly: https://github.com/faermanj/Sitting-Ducks/blob/master/cfn-beanstalk-env.yml
answered Nov 8 at 8:45
faermanj
7,87054565
7,87054565
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
add a comment |
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
This works, now I also need to put this inside a cloudformation if: !If [check, if true then the Fn::Join: - "", .. (the parth above); , if false then just "ok"]. Can you help me with that?
– mealesbia
Nov 8 at 14:01
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
Great, try using each statement/argument in separate line and always validate the YAML. The cloudformation lint is quite useful: github.com/awslabs/cfn-python-lint
– faermanj
2 days ago
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203799%2fhow-to-use-importvalue-and-join-in-cloudformation%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password