Documentation
¶
Index ¶
Constants ¶
const ( // Public Cloud PUBLIC_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.com/" PUBLIC_GRAPH_API_SCOPE = "https://graph.microsoft.com/.default" PUBLIC_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.com/v1.0" PUBLIC_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.com/beta" // US Department of Defense (DoD) Cloud USDOD_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.us/" USDOD_GRAPH_API_SCOPE = "https://graph.microsoft.us/.default" USDOD_GRAPH_API_SERVICE_ROOT = "https://dod-graph.microsoft.us/v1.0" USDOD_GRAPH_BETA_API_SERVICE_ROOT = "https://dod-graph.microsoft.us/beta" // US Government Cloud USGOV_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.com/" USGOV_GRAPH_API_SCOPE = "https://graph.microsoft.us/.default" USGOV_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.us/v1.0" USGOV_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.us/beta" // US Government High Cloud USGOVHIGH_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.us/" USGOVHIGH_GRAPH_API_SCOPE = "https://graph.microsoft.us/.default" USGOVHIGH_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.us/v1.0" USGOVHIGH_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.us/beta" // China Cloud (aka mooncake) - https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/o365-china-endpoints CHINA_OAUTH_AUTHORITY_URL = "https://login.chinacloudapi.cn/" CHINA_GRAPH_API_SCOPE = "https://microsoftgraph.chinacloudapi.cn/.default" CHINA_GRAPH_API_SERVICE_ROOT = "https://microsoftgraph.chinacloudapi.cn/v1.0" CHINA_GRAPH_BETA_API_SERVICE_ROOT = "https://microsoftgraph.chinacloudapi.cn/beta" // EagleX Cloud EX_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.eaglex.ic.gov/" EX_GRAPH_API_SCOPE = "https://graph.eaglex.ic.gov/.default" EX_GRAPH_API_SERVICE_ROOT = "https://graph.eaglex.ic.gov/v1.0" EX_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.eaglex.ic.gov/beta" // Secure Cloud (RX) RX_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.microsoft.scloud/" RX_GRAPH_API_SCOPE = "https://graph.microsoft.scloud/.default" RX_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.scloud/v1.0" RX_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.scloud/beta" )
const ( // GuidRegex matches a standard GUID/UUID. // Example: "123e4567-e89b-12d3-a456-426614174000" GuidRegex = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" // EntraIdSidRegex matches a Microsoft Entra ID (Azure AD) Security Identifier (SID). // Example: "S-1-12-1-1943430372-1249052806-2496021943-3034400218" EntraIdSidRegex = `^S-1-12-1-\d+-\d+-\d+-\d+$` // GuidOrEmptyValueRegex matches a standard GUID/UUID or an empty string. // Example: "123e4567-e89b-12d3-a456-426614174000" or "" GuidOrEmptyValueRegex = "^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})?$" // PrefixedGuidRegex matches a GUID with a single character prefix followed by underscore. // Example: "A_123e4567-e89b-12d3-a456-426614174000" or "T_00000000-0000-0000-0000-000000000000" PrefixedGuidRegex = "^[0-9a-zA-Z]_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" // GuidOrPrefixedGuidRegex matches either a standard GUID or a GUID with a single character prefix. // Example: "123e4567-e89b-12d3-a456-426614174000" or "A_123e4567-e89b-12d3-a456-426614174000" GuidOrPrefixedGuidRegex = "^(?:[0-9a-zA-Z]_)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" // UrlValidStringRegex matches a valid URL string (letters, numbers, and URL-safe characters). // Example: "https://example.com/path?query=1" UrlValidStringRegex = "(?i)^[A-Za-z0-9-._~%/:/?=]+$" // HttpOrHttpsUrlRegex matches a URL that starts with either http:// or https:// // Example: "https://example.com" or "http://example.org" HttpOrHttpsUrlRegex = "^https?://.*$" // EmailRegex matches a valid email address format // Example: "user@example.com" EmailRegex = `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` // UserPrincipalNameRegex matches a valid Microsoft 365 User Principal Name (UPN). // The UPN format follows RFC 822 and only allows specific characters in the alias portion. // Allowed characters: A-Z, a-z, 0-9, ' . - _ ! # ^ ~ // Example: "user.name@contoso.com" or "first-last@contoso.onmicrosoft.com" UserPrincipalNameRegex = `^[A-Za-z0-9'.\-_!#^~]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$` // ApiIdRegex matches API IDs consisting of alphanumeric characters, slashes, dots, or underscores. // Example: "api/v1/resource_1" ApiIdRegex = "^[0-9a-zA-Z/._]*$" // StringRegex matches any string (including empty). // Example: "any string here" StringRegex = "^.*$" // VersionRegex matches a version string in the format "X.Y.Z.W". // Example: "1.0.0.0" VersionRegex = "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$" // OSVersionRegex matches an operating system version string in the format "X.Y.Z.W" with any number of digits. // Example: "10.0.22631.9999" or "1.1.1.1" OSVersionRegex = `^\d+\.\d+\.\d+\.\d+$` // TimeFormatUTCTimeStampRegex matches a UTC timestamp in the format "YYYY-MM-DDTHH:MM:SSZ". // Example: "2023-05-01T13:45:30Z" TimeFormatUTCTimeStampRegex = "^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z)$" // BooleanRegex matches the string "true" or "false". // Example: "true" BooleanRegex = "^(true|false)$" // TimeFormatRFC3339Regex is the time format for RFC3339. // Example: "2023-05-01T13:45:30Z" TimeFormatRFC3339Regex = time.RFC3339 // ISO8601DurationRegex matches an ISO 8601 duration format. // Examples: "P1D" (1 day), "PT1H" (1 hour), "P1W" (1 week), "P1Y2M3DT4H5M6S" (1 year, 2 months, 3 days, 4 hours, 5 minutes, 6 seconds) ISO8601DurationRegex = `^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$` // AzureImageResourceIDRegex matches a valid Azure image resource ID for a custom image. // Example: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Compute/images/myimage" AzureImageResourceIDRegex = `^/subscriptions/[^/]+/resourceGroups/[^/]+/providers/Microsoft\.Compute/images/[^/]+$` // DateFormatYYYYMMDDRegex matches a date string in the format "YYYY-MM-DD". // Example: "2023-12-31" DateFormatYYYYMMDDRegex = "^\\d{4}-\\d{2}-\\d{2}$" // TimeFormatHHMMSSRegex matches a time string in the format "HH:MM:SS" (24-hour clock). // Example: "23:59:59" TimeFormatHHMMSSRegex = "^([01]\\d|2[0-3]):([0-5]\\d):([0-5]\\d)$" // IPv4CIDRRegex matches a valid IPv4 CIDR range. // Example: "192.168.1.0/24" IPv4CIDRRegex = `^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/(3[0-2]|[12]?[0-9])$` // IPv6CIDRRegex matches a valid IPv6 CIDR range. // Example: "2001:db8::/32" IPv6CIDRRegex = `^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$` // PortRangeRegex matches a valid port range 0-65535, hyphen separated // Example: "80-80", "443-443", "8080-8080", "8443-8443" PortRangeRegex = `` /* 153-byte string literal not displayed */ // SubjectKeyIdentifierRegex matches a Subject Key Identifier (SKI) in hexadecimal format (40 hex characters). // Example: "1A2B3C4D5E6F7A8B9C0D1E2F3A4B5C6D7E8F9A0B" SubjectKeyIdentifierRegex = `^[0-9A-Fa-f]{40}$` // X509CertificateIssuerRegex matches a custom certificate issuer identifier format (CUSTOMIDENTIFIER: followed by 40-character hex SKI). // Example: "CUSTOMIDENTIFIER:1A2B3C4D5E6F7A8B9C0D1E2F3A4B5C6D7E8F9A0B" X509CertificateIssuerRegex = `^CUSTOMIDENTIFIER:[0-9A-Fa-f]{40}$` // OIDRegex matches a valid Object Identifier in dotted decimal notation. // Example: "1.3.6.1.4.1.311.21.8.1.1" OIDRegex = `^[0-9]+(\.[0-9]+)+$` // ActiveDirectoryDNRegex matches a valid Active Directory distinguished name (DN). // Example: "OU=Computers,DC=contoso,DC=com" or "CN=Server1,OU=Servers,DC=contoso,DC=com" ActiveDirectoryDNRegex = `^(OU=|CN=)[^,]+(,(OU=|CN=|DC=)[^,]+)*$` // ISO8601DateTimeRegex matches an ISO 8601 datetime format with optional milliseconds and timezone. // Examples: "2023-05-01T13:45:30Z", "2023-05-01T13:45:30.123Z", "2023-05-01T13:45:30+00:00", "2023-05-01T13:45:30.123456+05:30" ISO8601DateTimeRegex = `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$` )
const ( SKUCPCB2C8RAM128GB = "CPC_B_2C_8RAM_128GB" SKUCPCE2C8GB128GB = "CPC_E_2C_8GB_128GB" SKUFLOWFREE = "FLOW_FREE" SKUMCOPSTNC = "MCOPSTNC" SKUMicrosoftEntraSuite = "Microsoft_Entra_Suite" SKUMicrosoftIntuneSuite = "Microsoft_Intune_Suite" SKUPOWERBISTANDARD = "POWER_BI_STANDARD" SKURMSBASIC = "RMSBASIC" SKUSPEE5 = "SPE_E5" SKUWindows365S2vCPU8GB128GB = "Windows_365_S_2vCPU_8GB_128GB" SKUWINDOWSSTORE = "WINDOWS_STORE" )
============================================================================ SKU Part Numbers (11 total) ============================================================================
const ( ServicePlanAADPREMIUMP2 = "AAD_PREMIUM_P2" // Shared: Microsoft_Entra_Suite, SPE_E5 ServicePlanEXCHANGESFOUNDATION = "EXCHANGE_S_FOUNDATION" // Shared: CPC_B_2C_8RAM_128GB, CPC_E_2C_8GB_128GB, FLOW_FREE, POWER_BI_STANDARD, RMSBASIC, WINDOWS_STORE ServicePlanM365LIGHTHOUSECUSTOMERPLAN1 = "M365_LIGHTHOUSE_CUSTOMER_PLAN1" // Shared: CPC_B_2C_8RAM_128GB, SPE_E5 ServicePlanPURVIEWDISCOVERY = "PURVIEW_DISCOVERY" // Shared: POWER_BI_STANDARD, SPE_E5 ServicePlanWindows10ESUCommercial = "Windows_10_ESU_Commercial" // Shared: CPC_B_2C_8RAM_128GB, CPC_E_2C_8GB_128GB )
============================================================================ Shared Service Plans (5 plans) These service plans appear in multiple SKUs ============================================================================
const ( ServicePlanCPCSS2 = "CPC_SS_2" ServicePlanM365LIGHTHOUSEPARTNERPLAN1 = "M365_LIGHTHOUSE_PARTNER_PLAN1" )
============================================================================ Service Plans from: CPC_B_2C_8RAM_128GB (2 plans) ============================================================================
const ( ServicePlanDYN365CDSVIRAL = "DYN365_CDS_VIRAL" ServicePlanFLOWP2VIRAL = "FLOW_P2_VIRAL" )
============================================================================ Service Plans from: FLOW_FREE (2 plans) ============================================================================
const ( ServicePlanEntraIDentityGovernance = "Entra_Identity_Governance" ServicePlanEntraPremiumInternetAccess = "Entra_Premium_Internet_Access" ServicePlanEntraPremiumPrivateAccess = "Entra_Premium_Private_Access" ServicePlanVerifiableCredentialsServiceRequest = "Verifiable_Credentials_Service_Request" )
============================================================================ Service Plans from: Microsoft_Entra_Suite (4 plans) ============================================================================
const ( ServicePlan3PARTYAPPPATCH = "3_PARTY_APP_PATCH" ServicePlanCLOUDPKI = "CLOUD_PKI" ServicePlanIntuneAdvancedea = "Intune_AdvancedEA" ServicePlanINTUNEP2 = "INTUNE_P2" ServicePlanIntuneServicenow = "Intune_ServiceNow" ServicePlanIntuneEPM = "Intune-EPM" ServicePlanIntuneMamtunnel = "Intune-MAMTunnel" ServicePlanREMOTEHELP = "REMOTE_HELP" )
============================================================================ Service Plans from: Microsoft_Intune_Suite (8 plans) ============================================================================
const ( ServicePlanAADPREMIUM = "AAD_PREMIUM" ServicePlanADALLOMSO365 = "ADALLOM_S_O365" ServicePlanADALLOMSSTANDALONE = "ADALLOM_S_STANDALONE" ServicePlanATA = "ATA" ServicePlanATPENTERPRISE = "ATP_ENTERPRISE" ServicePlanBIAZUREP2 = "BI_AZURE_P2" ServicePlanBingChatEnterprise = "Bing_Chat_Enterprise" ServicePlanBPOSSTODO3 = "BPOS_S_TODO_3" ServicePlanCDSO365P3 = "CDS_O365_P3" ServicePlanCLIPCHAMP = "CLIPCHAMP" ServicePlanCOMMONDEFENDERPLATFORMFOROFFICE = "COMMON_DEFENDER_PLATFORM_FOR_OFFICE" ServicePlanCOMMUNICATIONSCOMPLIANCE = "COMMUNICATIONS_COMPLIANCE" ServicePlanCOMMUNICATIONSDLP = "COMMUNICATIONS_DLP" ServicePlanContentExplorer = "Content_Explorer" ServicePlanContentexplorerStandard = "ContentExplorer_Standard" ServicePlanCUSTOMERKEY = "CUSTOMER_KEY" ServicePlanCustomerlockboxaEnterprise = "CustomerLockboxA_Enterprise" ServicePlanDATAINVESTIGATIONS = "DATA_INVESTIGATIONS" ServicePlanDefenderForIotEnterprise = "Defender_for_Iot_Enterprise" ServicePlanDeskless = "Deskless" ServicePlanDYN365CDSO365P3 = "DYN365_CDS_O365_P3" ServicePlanEQUIVIOANALYTICS = "EQUIVIO_ANALYTICS" ServicePlanEXCELPREMIUM = "EXCEL_PREMIUM" ServicePlanEXCHANGEANALYTICS = "EXCHANGE_ANALYTICS" ServicePlanEXCHANGESENTERPRISE = "EXCHANGE_S_ENTERPRISE" ServicePlanFLOWO365P3 = "FLOW_O365_P3" ServicePlanFORMSPLANE5 = "FORMS_PLAN_E5" ServicePlanGRAPHCONNECTORSSEARCHINDEX = "GRAPH_CONNECTORS_SEARCH_INDEX" ServicePlanINFOGOVERNANCE = "INFO_GOVERNANCE" ServicePlanINFORMATIONBARRIERS = "INFORMATION_BARRIERS" ServicePlanINSIDERRISK = "INSIDER_RISK" ServicePlanINSIDERRISKMANAGEMENT = "INSIDER_RISK_MANAGEMENT" ServicePlanINSIGHTSBYMYANALYTICS = "INSIGHTS_BY_MYANALYTICS" ServicePlanINTUNEA = "INTUNE_A" ServicePlanINTUNEO365 = "INTUNE_O365" ServicePlanKAIZALASTANDALONE = "KAIZALA_STANDALONE" ServicePlanLOCKBOXENTERPRISE = "LOCKBOX_ENTERPRISE" ServicePlanM365ADVANCEDAUDITING = "M365_ADVANCED_AUDITING" ServicePlanM365AUDITPLATFORM = "M365_AUDIT_PLATFORM" ServicePlanMCOEV = "MCOEV" ServicePlanMCOMEETADV = "MCOMEETADV" ServicePlanMCOSTANDARD = "MCOSTANDARD" ServicePlanMESHAVATARSADDITIONALFORTEAMS = "MESH_AVATARS_ADDITIONAL_FOR_TEAMS" ServicePlanMESHAVATARSFORTEAMS = "MESH_AVATARS_FOR_TEAMS" ServicePlanMESHIMMERSIVEFORTEAMS = "MESH_IMMERSIVE_FOR_TEAMS" ServicePlanMFAPREMIUM = "MFA_PREMIUM" ServicePlanMICROSOFTCOMMUNICATIONCOMPLIANCE = "MICROSOFT_COMMUNICATION_COMPLIANCE" ServicePlanMICROSOFTLOOP = "MICROSOFT_LOOP" ServicePlanMICROSOFTMYANALYTICSFULL = "MICROSOFT_MYANALYTICS_FULL" ServicePlanMICROSOFTSEARCH = "MICROSOFT_SEARCH" ServicePlanMICROSOFTBOOKINGS = "MICROSOFTBOOKINGS" ServicePlanMICROSOFTENDPOINTDLP = "MICROSOFTENDPOINTDLP" ServicePlanMIPSCLP1 = "MIP_S_CLP1" ServicePlanMIPSCLP2 = "MIP_S_CLP2" ServicePlanMIPSExchange = "MIP_S_Exchange" ServicePlanMLCLASSIFICATION = "ML_CLASSIFICATION" ServicePlanMTP = "MTP" ServicePlanMYANALYTICSP2 = "MYANALYTICS_P2" ServicePlanNucleus = "Nucleus" ServicePlanOFFICESUBSCRIPTION = "OFFICESUBSCRIPTION" ServicePlanPAMENTERPRISE = "PAM_ENTERPRISE" ServicePlanPEOPLESKILLSFOUNDATION = "PEOPLE_SKILLS_FOUNDATION" ServicePlanPLACESCORE = "PLACES_CORE" ServicePlanPOWERVIRTUALAGENTSO365P3 = "POWER_VIRTUAL_AGENTS_O365_P3" ServicePlanPOWERAPPSO365P3 = "POWERAPPS_O365_P3" ServicePlanPREMIUMENCRYPTION = "PREMIUM_ENCRYPTION" ServicePlanPROJECTO365P3 = "PROJECT_O365_P3" ServicePlanPROJECTWORKMANAGEMENT = "PROJECTWORKMANAGEMENT" ServicePlanRECORDSMANAGEMENT = "RECORDS_MANAGEMENT" ServicePlanRMSSENTERPRISE = "RMS_S_ENTERPRISE" ServicePlanRMSSPREMIUM = "RMS_S_PREMIUM" ServicePlanRMSSPREMIUM2 = "RMS_S_PREMIUM2" ServicePlanSAFEDOCS = "SAFEDOCS" ServicePlanSHAREPOINTENTERPRISE = "SHAREPOINTENTERPRISE" ServicePlanSHAREPOINTWAC = "SHAREPOINTWAC" ServicePlanSTREAMO365E5 = "STREAM_O365_E5" ServicePlanSWAY = "SWAY" ServicePlanTEAMS1 = "TEAMS1" ServicePlanTHREATINTELLIGENCE = "THREAT_INTELLIGENCE" ServicePlanUNIVERSALPRINT01 = "UNIVERSAL_PRINT_01" ServicePlanVIVALEARNINGSEEDED = "VIVA_LEARNING_SEEDED" ServicePlanVIVAENGAGECORE = "VIVAENGAGE_CORE" ServicePlanWHITEBOARDPLAN3 = "WHITEBOARD_PLAN3" ServicePlanWIN10PROENTSUB = "WIN10_PRO_ENT_SUB" ServicePlanWINDEFATP = "WINDEFATP" ServicePlanWindowsAutopatch = "Windows_Autopatch" ServicePlanWINDOWSUPDATEFORBUSINESSDEPLOYMENTSERVICE = "WINDOWSUPDATEFORBUSINESS_DEPLOYMENTSERVICE" ServicePlanYAMMERENTERPRISE = "YAMMER_ENTERPRISE" )
============================================================================ Service Plans from: SPE_E5 (88 plans) ============================================================================
const ( ServicePlanCPCS2C8GB128GB = "CPC_S_2C_8GB_128GB" ServicePlanWINDOWS10ESUTENANT = "WINDOWS_10_ESU_TENANT" )
============================================================================ Service Plans from: Windows_365_S_2vCPU_8GB_128GB (2 plans) ============================================================================
const (
ServicePlanBIAZUREP0 = "BI_AZURE_P0"
)
============================================================================ Service Plans from: POWER_BI_STANDARD (1 plans) ============================================================================
const (
ServicePlanCPC2 = "CPC_2"
)
============================================================================ Service Plans from: CPC_E_2C_8GB_128GB (1 plans) ============================================================================
const (
ServicePlanMCOPSTNC = "MCOPSTNC"
)
============================================================================ Service Plans from: MCOPSTNC (1 plans) ============================================================================
const (
ServicePlanRMSSBASIC = "RMS_S_BASIC"
)
============================================================================ Service Plans from: RMSBASIC (1 plans) ============================================================================
const (
ServicePlanWINDOWSSTORE = "WINDOWS_STORE"
)
============================================================================ Service Plans from: WINDOWS_STORE (1 plans) ============================================================================
Variables ¶
var GraphSDKMutex sync.Mutex
GraphSDKMutex is a global lock used to serialize Microsoft Graph SDK (Kiota) API calls.
Reason: Kiota's middleware (e.g., HeadersInspectionHandler) modifies shared header maps during HTTP request processing. In Go, maps are not concurrency-safe — concurrent writes cause immediate fatal runtime panics ("concurrent map writes").
Terraform executes Read operations across multiple resources in parallel, leading to multiple Graph API calls at the same time. Without locking, simultaneous mutation of the shared headers map causes the plugin to crash.
By acquiring this mutex around Graph API calls (Get, Post, Patch, Delete), we ensure only one request is processed at a time through the Kiota pipeline, preventing concurrency issues and plugin crashes.
You cannot set a mutex as a constant in go.
Functions ¶
This section is empty.
Types ¶
This section is empty.