Skip to content

Regenerate Bicep files with new translator and update baseline#158

Open
jiangmingzhe wants to merge 4 commits into
Azure:mainfrom
jiangmingzhe:release/bicep-samples-02092025-2
Open

Regenerate Bicep files with new translator and update baseline#158
jiangmingzhe wants to merge 4 commits into
Azure:mainfrom
jiangmingzhe:release/bicep-samples-02092025-2

Conversation

@jiangmingzhe
Copy link
Copy Markdown
Member

@jiangmingzhe jiangmingzhe commented Feb 10, 2026

Translate all the Terraform files with new translator.

The new translator went through an architecture change that make it easier to support more scenarios in future.

Previous translator still has 14 translation failures, while the new translator has zero translation failures, besides the Terraform files that are skipped for translation.

Comment on lines +4 to +6
var keyspaceName = 'resourcenameks'
var tableName = 'resourcenametbl'
var accountName = 'resourcename'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a regression in the generated output

Copy link
Copy Markdown
Member Author

@jiangmingzhe jiangmingzhe May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the translation logic automatically evaluates the local structure in the Terraforma and places the string result in the bicep. I've made the change to keep the original function invocation and interpolation and translate to corresponding var structure in Bicep

var accountName = toLower(replace(resourceName, '-', ''))
var keyspaceName = '${toLower(resourceName)}ks'
var tableName = '${toLower(resourceName)}tbl'

clientRegistrationEndpoint: 'https://azacceptance.hashicorptest.com/client/register'
clientSecret: null
defaultScope: ''
clientSecret: '${oauthClientSecret}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interpolation here is unnecessary - instead of:

clientSecret: '${oauthClientSecret}'

It's idiomatic to output:

clientSecret: oauthClientSecret

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I've fixed this in the new release

Comment on lines +12 to +15
publicNetworkAccess: 'Enabled'
publisherEmail: 'pub1@email.com'
publisherName: 'pub1'
virtualNetworkType: 'None'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for the change in ordering of these properties? Is this to match the original source file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original ordering is not preserved during translation since I was using unordered map to the intermediate nodes. I have added a list to keep the order of the properties, now the generated bicep resource properties should have the same order

tier: 'GeneralPurpose'
identity: {
type: 'None'
userAssignedIdentities: null
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we omit this property entirely instead of setting to null?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed null value property emission

resource policy 'Microsoft.DevTestLab/labs/policySets/policies@2018-09-15' = {
parent: policySet
name: 'LabVmCount'
name: 'policySets/default/LabVmCount'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code looked more idiomatic here - better to use the parent property with an existing resource, than to use a fully-qualified name

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the existing resource emission

@github-project-automation github-project-automation Bot moved this to Todo in Bicep May 13, 2026
@stephaniezyen stephaniezyen added this to the v0.44 milestone May 13, 2026
@jiangmingzhe jiangmingzhe force-pushed the release/bicep-samples-02092025-2 branch from f597155 to 6cc70b0 Compare May 18, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants