Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accepting organization invitation causes 404 #636

Closed
matthewvalimaki opened this issue Dec 10, 2021 · 4 comments
Closed

Accepting organization invitation causes 404 #636

matthewvalimaki opened this issue Dec 10, 2021 · 4 comments
Assignees

Comments

@matthewvalimaki
Copy link

Terraform CLI and Terraform MongoDB Atlas Provider Version

Terraform v1.1.0
on linux_amd64
+ provider registry.terraform.io/mongodb/mongodbatlas v1.1.1

Terraform Configuration File

terraform {
  backend "remote" {
    organization = "myorg"

    workspaces {
      name = "mongodb-dev"
    }
  }
}

terraform {
  required_providers {
    mongodbatlas = {
      source = "mongodb/mongodbatlas"
    }
  }
}

provider "mongodbatlas" {
  public_key = var.public_key
  private_key = var.private_key
}

resource "mongodbatlas_org_invitation" "invitation" {
  for_each = { for invitation in local.invitations : invitation.name => invitation }
  username = each.value.username
  org_id = each.value.org_id
  roles = each.value.roles
}

Steps to Reproduce

  1. terraform init
  2. terraform apply
  3. Manually accept organizational invitations that were sent via email
  4. terraform apply

Expected Behavior

Running terraform apply regardless of invitation status (accepted, pending, expired etc.) should pass with potentially Terraform informing of remote state change due to invitation status change. Should status change (for example due acceptance of an invitation) terraform apply -refresh-only should be used to update Terraform state.

Actual Behavior

Running terraform apply errors after "Refreshing state..." if any invited user accepts their invitation. Removal of user from Terraform list of invitees does not correct situation as the invitation information is in Terraform state.

Debug Output

note: below <org_id> and <invitation_id> are replacing sensitive pieces of information.

021-12-10T09:29:48.181-0800 [INFO]  provider.terraform-provider-mongodbatlas_v1.1.1: 2021/12/10 09:29:48 [DEBUG] MongoDB Atlas API Request Details:
---[ REQUEST ]---------------------------------------
GET /api/atlas/v1.0/orgs/<org_id>/invites/<invitation_id> HTTP/1.1
Host: cloud.mongodb.com
User-Agent: terraform-provider-mongodbatlas/1.1.1 go-mongodbatlas/0.14.0 (linux;amd64)
Accept: application/json
Accept-Encoding: gzip

-----------------------------------------------------: timestamp=2021-12-10T09:29:48.181-0800
2021-12-10T09:29:48.531-0800 [INFO]  provider.terraform-provider-mongodbatlas_v1.1.1: 2021/12/10 09:29:48 [DEBUG] MongoDB Atlas API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 404 Not Found
Content-Length: 188
Content-Type: application/json
Date: Fri, 10 Dec 2021 17:29:49 GMT
Referrer-Policy: strict-origin-when-cross-origin
Server: envoy
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload;
X-Envoy-Upstream-Service-Time: 50
X-Frame-Options: DENY
X-Mongodb-Service-Version: gitHash=fda8ea3ded0f247591e688b1ca6faf7728138d33; versionString=v20211202
X-Permitted-Cross-Domain-Policies: none

{
 "detail": "An invalid invitation ID <invitation_id> was specified.",
 "error": 404,
 "errorCode": "INVALID_INVITATION_ID",
 "parameters": [
  "<invitation_id>"
 ],
 "reason": "Not Found"
}

References

@themantissa
Copy link
Collaborator

@matthewvalimaki thank you for the clear report. Will have the team investigate it.

@themantissa
Copy link
Collaborator

Internal ticket INTMDB-285

@themantissa
Copy link
Collaborator

@matthewvalimaki we are about to release the fix in version 1.2. The pre-release is completed if you'd like to test first. Thank you.

@themantissa
Copy link
Collaborator

Released in 1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants