Azure ARM Template: DependsOn conditional statement












0















Does anyone know if there is a way to put an inline conditional statement inside the dependsOn element? I want to put a condition in that the resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already.



Any help is appreciated!



  "dependsOn": [
"[or(nestedTemplateA, nestedTemplateB)]"
],









share|improve this question





























    0















    Does anyone know if there is a way to put an inline conditional statement inside the dependsOn element? I want to put a condition in that the resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already.



    Any help is appreciated!



      "dependsOn": [
    "[or(nestedTemplateA, nestedTemplateB)]"
    ],









    share|improve this question



























      0












      0








      0








      Does anyone know if there is a way to put an inline conditional statement inside the dependsOn element? I want to put a condition in that the resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already.



      Any help is appreciated!



        "dependsOn": [
      "[or(nestedTemplateA, nestedTemplateB)]"
      ],









      share|improve this question
















      Does anyone know if there is a way to put an inline conditional statement inside the dependsOn element? I want to put a condition in that the resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already.



      Any help is appreciated!



        "dependsOn": [
      "[or(nestedTemplateA, nestedTemplateB)]"
      ],






      json azure arm-template azure-template






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 '18 at 15:07









      4c74356b41

      32.3k42557




      32.3k42557










      asked Nov 28 '18 at 22:55









      chew224chew224

      658




      658
























          1 Answer
          1






          active

          oldest

          votes


















          2














          ok, first of all, you can depend on existence of something (strictly speaking), you can only depend on resource being created successfully in the same (!!) template. so if your template has this structure:



          resource1 - nested template
          resource2 - nested template
          resource3 - the one you are asking about


          you just need to use this as dependsOn:



          "dependsOn": [
          "resource1",
          "resource2"
          ]


          but, as your question reads: "resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already." its really hard for me to be sure I'm answering the right question. if this is not what you are asking about, can you please comment on this answer if you need more help (and, perhaps, rephrase your question). I'll edit this answer, cheers!






          share|improve this answer
























          • I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

            – chew224
            Nov 29 '18 at 15:04











          • basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

            – 4c74356b41
            Nov 29 '18 at 15:07






          • 1





            This is perfect, thank you for the correct answer!

            – chew224
            Dec 29 '18 at 18:06






          • 1





            you can upvote helpful answers as well :)

            – 4c74356b41
            Dec 29 '18 at 18:07














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53529333%2fazure-arm-template-dependson-conditional-statement%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          ok, first of all, you can depend on existence of something (strictly speaking), you can only depend on resource being created successfully in the same (!!) template. so if your template has this structure:



          resource1 - nested template
          resource2 - nested template
          resource3 - the one you are asking about


          you just need to use this as dependsOn:



          "dependsOn": [
          "resource1",
          "resource2"
          ]


          but, as your question reads: "resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already." its really hard for me to be sure I'm answering the right question. if this is not what you are asking about, can you please comment on this answer if you need more help (and, perhaps, rephrase your question). I'll edit this answer, cheers!






          share|improve this answer
























          • I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

            – chew224
            Nov 29 '18 at 15:04











          • basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

            – 4c74356b41
            Nov 29 '18 at 15:07






          • 1





            This is perfect, thank you for the correct answer!

            – chew224
            Dec 29 '18 at 18:06






          • 1





            you can upvote helpful answers as well :)

            – 4c74356b41
            Dec 29 '18 at 18:07


















          2














          ok, first of all, you can depend on existence of something (strictly speaking), you can only depend on resource being created successfully in the same (!!) template. so if your template has this structure:



          resource1 - nested template
          resource2 - nested template
          resource3 - the one you are asking about


          you just need to use this as dependsOn:



          "dependsOn": [
          "resource1",
          "resource2"
          ]


          but, as your question reads: "resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already." its really hard for me to be sure I'm answering the right question. if this is not what you are asking about, can you please comment on this answer if you need more help (and, perhaps, rephrase your question). I'll edit this answer, cheers!






          share|improve this answer
























          • I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

            – chew224
            Nov 29 '18 at 15:04











          • basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

            – 4c74356b41
            Nov 29 '18 at 15:07






          • 1





            This is perfect, thank you for the correct answer!

            – chew224
            Dec 29 '18 at 18:06






          • 1





            you can upvote helpful answers as well :)

            – 4c74356b41
            Dec 29 '18 at 18:07
















          2












          2








          2







          ok, first of all, you can depend on existence of something (strictly speaking), you can only depend on resource being created successfully in the same (!!) template. so if your template has this structure:



          resource1 - nested template
          resource2 - nested template
          resource3 - the one you are asking about


          you just need to use this as dependsOn:



          "dependsOn": [
          "resource1",
          "resource2"
          ]


          but, as your question reads: "resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already." its really hard for me to be sure I'm answering the right question. if this is not what you are asking about, can you please comment on this answer if you need more help (and, perhaps, rephrase your question). I'll edit this answer, cheers!






          share|improve this answer













          ok, first of all, you can depend on existence of something (strictly speaking), you can only depend on resource being created successfully in the same (!!) template. so if your template has this structure:



          resource1 - nested template
          resource2 - nested template
          resource3 - the one you are asking about


          you just need to use this as dependsOn:



          "dependsOn": [
          "resource1",
          "resource2"
          ]


          but, as your question reads: "resource will deploy on if either nestedTemplateA exists already OR if nestedTemplateB exists already." its really hard for me to be sure I'm answering the right question. if this is not what you are asking about, can you please comment on this answer if you need more help (and, perhaps, rephrase your question). I'll edit this answer, cheers!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 29 '18 at 5:44









          4c74356b414c74356b41

          32.3k42557




          32.3k42557













          • I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

            – chew224
            Nov 29 '18 at 15:04











          • basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

            – 4c74356b41
            Nov 29 '18 at 15:07






          • 1





            This is perfect, thank you for the correct answer!

            – chew224
            Dec 29 '18 at 18:06






          • 1





            you can upvote helpful answers as well :)

            – 4c74356b41
            Dec 29 '18 at 18:07





















          • I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

            – chew224
            Nov 29 '18 at 15:04











          • basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

            – 4c74356b41
            Nov 29 '18 at 15:07






          • 1





            This is perfect, thank you for the correct answer!

            – chew224
            Dec 29 '18 at 18:06






          • 1





            you can upvote helpful answers as well :)

            – 4c74356b41
            Dec 29 '18 at 18:07



















          I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

          – chew224
          Nov 29 '18 at 15:04





          I see exactly what you are saying. I do have multiple resources (resource1, resource2, resource3). However, these resources are conditionals, so sometimes they are being deployed, sometimes not. I was wondering if it is possible to use the dependsOn element as a conditional statement. For example, if resource1 OR resource2 is deployed successfully, then create resource4.

          – chew224
          Nov 29 '18 at 15:04













          basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

          – 4c74356b41
          Nov 29 '18 at 15:07





          basically just dependOn both, if they are skipped it wont crash. Also, if you need to skip it completely if they both are skipped, you need to use a condition. basically, just always depend on something you need to depend on, if its skipped, dependsOn doesnt break.

          – 4c74356b41
          Nov 29 '18 at 15:07




          1




          1





          This is perfect, thank you for the correct answer!

          – chew224
          Dec 29 '18 at 18:06





          This is perfect, thank you for the correct answer!

          – chew224
          Dec 29 '18 at 18:06




          1




          1





          you can upvote helpful answers as well :)

          – 4c74356b41
          Dec 29 '18 at 18:07







          you can upvote helpful answers as well :)

          – 4c74356b41
          Dec 29 '18 at 18:07






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53529333%2fazure-arm-template-dependson-conditional-statement%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks