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

Using information from existing resources - requires a value that can be calculated at the start of the deployment #3911

Closed
ehrnst opened this issue Aug 5, 2021 · 3 comments
Labels
intermediate language Related to the intermediate language Needs: Author Feedback Awaiting feedback from the author of the issue Needs: Triage 🔍

Comments

@ehrnst
Copy link
Contributor

ehrnst commented Aug 5, 2021

Bicep version
Bicep CLI version 0.4.451

Describe the bug
I'm trying to provision a public ip from an existing prefix. And I want to use information about sku and zones from that prefix. However these values cannot be evaluated, and hence i get an error in bicep. I have tried to set dependsOn without any effect.

To Reproduce

resource pipPrefix 'Microsoft.Network/publicIPPrefixes@2021-02-01' existing = {
  name: '${env}-pip-prefix'
  scope: resourceGroup('test-${env}-rg')
}

resource aksEgressIp 'Microsoft.Network/publicIPAddresses@2021-02-01' = {
  name: '${aksSettings.clusterName}-egress-pip'
  location: resourceGroup().location
  sku: {
    name: 'Standard'
    tier: 'Regional'
  }
  zones: pipPrefix.zones
  properties:{
    publicIPAllocationMethod: 'Static'
    publicIPPrefix: {
      id: pipPrefix.id
    }
  }
}
@ghost ghost added the Needs: Triage 🔍 label Aug 5, 2021
@alex-frankel
Copy link
Collaborator

Unfortunately we have a runtime limitation that requires any top level properties (name, zones, etc.) to be known at "compile-time" and so it can't be a runtime reference to an existing resource. My understanding is that this only needs to be restricted for name since we need to construct the resource ID with that name. For the others like sku and zones we should be able to relax the restriction.

In the meantime, you may be able to work around this with modules. If you pass in pipPrefix.zones as a param to a module which creates the publicIPAddress, I think you avoid the check.

@ehrnst
Copy link
Contributor Author

ehrnst commented Aug 6, 2021

Unfortunately we have a runtime limitation that requires any top level properties (name, zones, etc.) to be known at "compile-time" and so it can't be a runtime reference to an existing resource. My understanding is that this only needs to be restricted for name since we need to construct the resource ID with that name. For the others like sku and zones we should be able to relax the restriction.

In the meantime, you may be able to work around this with modules. If you pass in pipPrefix.zones as a param to a module which creates the publicIPAddress, I think you avoid the check.

Thanks, i will try that!

@alex-frankel alex-frankel added intermediate language Related to the intermediate language and removed Needs: Triage 🔍 labels Aug 6, 2021
@ghost
Copy link

ghost commented May 24, 2023

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

@ghost ghost closed this as completed Jun 3, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 3, 2023
@StephenWeatherford StephenWeatherford added Needs: Author Feedback Awaiting feedback from the author of the issue and removed awaiting response labels Oct 13, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
intermediate language Related to the intermediate language Needs: Author Feedback Awaiting feedback from the author of the issue Needs: Triage 🔍
Projects
Archived in project
Development

No branches or pull requests

3 participants