microsoft / microsoft/terraform-provider-msgraph

"Failed to read data source" when creating authenticationContextClassReferences

Open
#69 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

upstream-api
Dominant language
Go
Stars
65
Forks
25
Avg merge
3d 10h
Merged PRs (30d)
6

Description

I try to create a conditional access authentication context. I use the following code:

resource "msgraph_update_resource" "authctx_pim_role_activation" {
  url        = "identity/conditionalAccess/authenticationContextClassReferences/c2"
  api_version = "v1.0"
  body = {
    displayName = "Privileged Identity Management: Role Activation"
    description = "This context is used to apply conditional access policies to Privileged Identity Management (PIM) activations."
    isAvailable = true
  }

}

However, apply fails with this error:

Error: Failed to read data source
│ 
│   with module.conditional_access.msgraph_update_resource.authctx_pim_role_activation,
│   on conditional_access/main.tf line 64, in resource "msgraph_update_resource" "authctx_pim_role_activation":
│   64: resource "msgraph_update_resource" "authctx_pim_role_activation" {
│ 
│ GET
│ https://graph.microsoft.com/v1.0/identity/conditionalAccess/authenticationContextClassReferences/c2
│ --------------------------------------------------------------------------------
│ RESPONSE 201: 201 Created
│ ERROR CODE UNAVAILABLE
│ --------------------------------------------------------------------------------
│ {
│   "@odata.context": "[https://graph.microsoft.com/v1.0/$metadata#identity/conditionalAccess/authenticationContextClassReferences/$entity",](https://graph.microsoft.com/v1.0/$metadata#identity/conditionalAccess/authenticationContextClassReferences/$entity%22,)
│   "id": "c2",
│   "displayName": "Privileged Identity Management: Role Activation",
│   "description": "This context is used to apply conditional access policies to Privileged Identity Management (PIM) activations.",
│   "isAvailable": true
│ }

The authentication context was created successfully even though terraform reports an error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the msgraph_update_resource resource and reproduce the configuration in conditional_access/main.tf at line 64 against the authenticationContextClassReferences/c2 endpoint. Trace the post-create read that reports the 201 response as a failure; done means Terraform apply completes without a false error while the authentication context remains created.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
api, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.