Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Add to output identity block values #85

Merged
merged 1 commit into from
Aug 5, 2024
Merged

Add to output identity block values #85

merged 1 commit into from
Aug 5, 2024

Conversation

zioproto
Copy link
Contributor

Describe your changes

Add the values from the identity block in the module output
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account

Issue number

#84

Checklist before requesting a review

  • [ X] The pr title can be used to describe what this pr did in CHANGELOG.md file
  • [ X] I have executed pre-commit on my machine
  • [ X] I have passed pr-check on my machine

Thanks for your cooperation!

outputs.tf Outdated

output "principal_id" {
description = "The Principal ID associated with this Managed Service Identity."
value = azurerm_cognitive_account.this.identity[0].principal_id
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lonegunmanb Question: is it correct to create an output for each element of the identity block of the resource ? or I should have created a single output exposing the all block ?

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account

Copy link
Member

Choose a reason for hiding this comment

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

@zioproto I think we need a try here since it's possible to have an account without identity block.

is it correct to create an output for each element of the identity block of the resource ? or I should have created a single output exposing the all block ?

Both works for me, I would say let's output the identity block:

output "cognitive_account_identity" {
  ...
  value = try(azurerm_cognitive_account.this.identity[0], null)
}

@zioproto zioproto requested a review from lonegunmanb July 10, 2024 08:52
outputs.tf Outdated

output "principal_id" {
description = "The Principal ID associated with this Managed Service Identity."
value = azurerm_cognitive_account.this.identity[0].principal_id
Copy link
Member

Choose a reason for hiding this comment

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

@zioproto I think we need a try here since it's possible to have an account without identity block.

is it correct to create an output for each element of the identity block of the resource ? or I should have created a single output exposing the all block ?

Both works for me, I would say let's output the identity block:

output "cognitive_account_identity" {
  ...
  value = try(azurerm_cognitive_account.this.identity[0], null)
}

@zioproto
Copy link
Contributor Author

@lonegunmanb please take a look again and merge if this is now OK. Thank you

Copy link
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Thanks @zioproto , LGTM! 🚀

@lonegunmanb lonegunmanb merged commit 6fae620 into main Aug 5, 2024
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants