Skip to content

Latest commit

 

History

History
142 lines (113 loc) · 2.83 KB

azuread_service_principal.md

File metadata and controls

142 lines (113 loc) · 2.83 KB

azuread_service_principal

back

Index

Terraform

terraform {
  required_providers {
    azuread = ">= 1.4.0"
  }
}

top

Example Usage

module "azuread_service_principal" {
  source = "./modules/azuread/r/azuread_service_principal"

  # app_role_assignment_required - (optional) is a type of bool
  app_role_assignment_required = null
  # application_id - (required) is a type of string
  application_id = null
  # tags - (optional) is a type of set of string
  tags = []

  oauth2_permissions = [{
    admin_consent_description  = null
    admin_consent_display_name = null
    id                         = null
    is_enabled                 = null
    type                       = null
    user_consent_description   = null
    user_consent_display_name  = null
    value                      = null
  }]
}

top

Variables

variable "app_role_assignment_required" {
  description = "(optional)"
  type        = bool
  default     = null
}

variable "application_id" {
  description = "(required)"
  type        = string
}

variable "tags" {
  description = "(optional)"
  type        = set(string)
  default     = null
}

variable "oauth2_permissions" {
  description = "nested block: NestingList, min items: 0, max items: 0"
  type = set(object(
    {
      admin_consent_description  = string
      admin_consent_display_name = string
      id                         = string
      is_enabled                 = bool
      type                       = string
      user_consent_description   = string
      user_consent_display_name  = string
      value                      = string
    }
  ))
  default = []
}

top

Resource

resource "azuread_service_principal" "this" {
  # app_role_assignment_required - (optional) is a type of bool
  app_role_assignment_required = var.app_role_assignment_required
  # application_id - (required) is a type of string
  application_id = var.application_id
  # tags - (optional) is a type of set of string
  tags = var.tags

  dynamic "oauth2_permissions" {
    for_each = var.oauth2_permissions
    content {
    }
  }

}

top

Outputs

output "app_roles" {
  description = "returns a list of object"
  value       = azuread_service_principal.this.app_roles
}

output "display_name" {
  description = "returns a string"
  value       = azuread_service_principal.this.display_name
}

output "id" {
  description = "returns a string"
  value       = azuread_service_principal.this.id
}

output "object_id" {
  description = "returns a string"
  value       = azuread_service_principal.this.object_id
}

output "this" {
  value = azuread_service_principal.this
}

top