Skip to content

Commit eec8db6

Browse files
committed
fix terraform identity resource format
1 parent 5983155 commit eec8db6

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/TemplateRefGenerator.Tests/Files/markdown/microsoft.documentdb/2024-05-15/databaseaccounts.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ The following [Azure Verified Modules](https://aka.ms/avm) can be used to deploy
426426
> | Module | Description |
427427
> | ----- | ----- |
428428
> | [CosmosDB Database Account](https://github.com/Azure/bicep-registry-modules/tree/main/avm/res/document-db/database-account) | AVM Resource Module for CosmosDB Database Account |
429-
429+
430430
### Azure Quickstart Samples
431431

432432
The following [Azure Quickstart templates](https://aka.ms/azqst) contain Bicep samples for deploying this resource type.
@@ -880,12 +880,11 @@ To create a Microsoft.DocumentDB/databaseAccounts resource, add the following Te
880880
resource "azapi_resource" "symbolicname" {
881881
type = "Microsoft.DocumentDB/databaseAccounts@2024-05-15"
882882
name = "string"
883-
identity = {
883+
identity {
884884
type = "string"
885-
userAssignedIdentities = {
886-
{customized property} = {
887-
}
888-
}
885+
identity_ids = = [
886+
"string"
887+
]
889888
}
890889
location = "string"
891890
tags = {

src/TemplateRefGenerator/Generators/CodeSampleGenerator.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,17 @@ void AddProperty(string name, Action writeValue)
369369
{
370370
AddProperty("parent_id", () => sb.Append($"\"string\""));
371371
}
372+
373+
if (props.FirstOrDefault(x => x.Key == "identity") is {} identityProp && identityProp.Key != null)
374+
{
375+
props.Remove(identityProp);
376+
sb.AppendLine("identity {{");
377+
sb.AppendLine($"{propIndent} type = \"string\"");
378+
sb.AppendLine($"{propIndent} identity_ids = [");
379+
sb.AppendLine($"{propIndent} \"string\"");
380+
sb.AppendLine($"{propIndent} ]");
381+
sb.AppendLine($"{propIndent}}}");
382+
}
372383
}
373384

374385
var bodyProps = props.Where(x => path == "" && !TerraformRootProperties.Contains(x.Key)).ToList();

0 commit comments

Comments
 (0)