Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional adding logic app steps #14192

Closed
TomaszGrzmilas opened this issue May 30, 2024 · 3 comments
Closed

Conditional adding logic app steps #14192

TomaszGrzmilas opened this issue May 30, 2024 · 3 comments
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue Status: No Recent Activity

Comments

@TomaszGrzmilas
Copy link

TomaszGrzmilas commented May 30, 2024

Bicep version
0.27.1

Describe the bug
I can't conditional add logic app step

To Reproduce
Create logic app using bicep:

`@allowed([
  'DEV'
  'PROD'
])
param TargetEnvironment string = 'DEV'

resource resource 'Microsoft.Logic/workflows@2019-05-01' = {
  name: 'TEST'
  location: 'polandcentral'
  properties: {
    state: 'Enabled'
    (...)
      actions: {
        (...)
		Delete_file: (TargetEnvironment == 'PROD') ? {
		  runAfter: {
			Send_file: [
			  'Succeeded'
			]
		  }
		  (...)
		} : null
        (...)
      outputs: {}
    }
  }
}`

This cause error while deploying. Tried also json(null) and {} neither works.

@stephaniezyen
Copy link
Contributor

Can you please share with us the error you are receiving when deploying this file?

@stephaniezyen stephaniezyen added Needs: Author Feedback Awaiting feedback from the author of the issue and removed Needs: Triage 🔍 labels Jun 12, 2024
@anthony-c-martin
Copy link
Member

If the problem is that null is being rejected, have you tried using the spread operator (...)?

Something like the following change:

@allowed([
  'DEV'
  'PROD'
])
param TargetEnvironment string = 'DEV'

resource resource 'Microsoft.Logic/workflows@2019-05-01' = {
  name: 'TEST'
  location: 'polandcentral'
  properties: {
    state: 'Enabled'
    (...)
      actions: {
        (...)
-          Delete_file: (TargetEnvironment == 'PROD') ? {
+          ...(TargetEnvironment == 'PROD' ? {
+            Delete_file: {
            runAfter: {
              Send_file: [
                'Succeeded'
              ]
            }
            (...)
-          } : null
+            }
+          } : { })
        (...)
      outputs: {}
    }
  }
}

Copy link
Contributor

Hi @TomaszGrzmilas, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! 😄 🦾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue Status: No Recent Activity
Projects
Archived in project
Development

No branches or pull requests

3 participants