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

Cannot use modules with templateSpec aliases in upper AD Tenants/Environments due to templateLink.id hard set to development environments RG #5010

Closed
stweb1963 opened this issue Oct 27, 2021 · 3 comments
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue Needs: Triage 🔍

Comments

@stweb1963
Copy link

Issue

When using a module that references a templateSpecs template the generated output is hard referenced to the final resourceId of the

{
  "templateLink": {
    "id":"{resourceId}"
  }
}

Unfortunately we operated in 3 distinct tenants/environments (dev/uat/prod) and deploy our templateSpecs into a targeted resourceGroups per environment

The issue we have is due to the hardcoded templateLink.id we cannot use the generated output in any environment other then the one we develop and deploy from.

Example

module test 'ts/Core:resources_resourcegroups:0.2.0' = {
  name: '${deployment().name}.rg'
  params: {
    name: resourceGroupName
    baseTags: baseTags
    extraTags: extraTags
    env: env
    regionCode: regionCode
  }
}
{
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2020-06-01",
    "name": "[format('{0}.rg', deployment().name)]",
    "location": "[deployment().location]",
    "properties": {
        "expressionEvaluationOptions": {
            "scope": "inner"
        },
        "mode": "Incremental",
        "parameters": {
            "name": {
                "value": "[variables('resourceGroupName')]"
            },
            "baseTags": {
                "value": "[parameters('baseTags')]"
            },
            "extraTags": {
                "value": "[parameters('extraTags')]"
            },
            "env": {
                "value": "[parameters('env')]"
            },
            "regionCode": {
                "value": "[parameters('regionCode')]"
            }
        },
        "templateLink": {
            "id": "/subscriptions/{guid}/resourceGroups/{rgName}/providers/Microsoft.Resources/templateSpecs/{ts name}/versions/{ts version}"
        }
    }
}

Desired

Allow the ability to override the templateLink.Id final format

var resourceGroupId = '{rgId}'

module test 'ts/Core:resources_resourcegroups:0.2.0' = {
  name: '${deployment().name}.rg'
  params: {
    name: resourceGroupName
    baseTags: baseTags
    extraTags: extraTags
    env: env
    regionCode: regionCode
  }
  templateLink: resourceGroupId
}
@stweb1963 stweb1963 added the enhancement New feature or request label Oct 27, 2021
@ghost ghost added the Needs: Triage 🔍 label Oct 27, 2021
@alex-frankel
Copy link
Collaborator

Is there an option to have multiple bicepconfig.json files associated with each environment? i.e. bicepconfig-dev.json, bicepconfig-uat.json etc? That way your bicep code stays the same and only the alias should need to be updated. Thoughts?

@stweb1963
Copy link
Author

Currently for our templateSpecs we

  • build (artifact)
  • publish
    • dev
    • uat
    • prod
  • consume

To achieve this I believe would either have to

  • build in each
    • build/publish/dev
    • build/publish/uat
    • build/publish/prod
  • or
    • build all environments and then publish each

What's more interesting is the bicep registry which we have already seen places to reduce our bicep code (snippets of bicep) reuse. Currently we see using the BR in our development cycle and produce the final templates that get published to templateSpecs

We only see having the registry within our development area
If we need to build against each target environment then I believe we would also require deploying, managing and publishing to a registry in each environment as well

Thoughts?

@ghost
Copy link

ghost commented May 24, 2023

Hi stweb1963, 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! 😄 🦾

@github-project-automation github-project-automation bot moved this to Todo in Bicep May 24, 2023
@ghost ghost closed this as completed Jun 3, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Bicep 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
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