Skip to content

Project data source #142

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

Merged
merged 5 commits into from
Feb 20, 2020
Merged

Project data source #142

merged 5 commits into from
Feb 20, 2020

Conversation

PacoDw
Copy link
Contributor

@PacoDw PacoDw commented Feb 20, 2020

Added:

  • The name and project_id can be used in the data source to query, but one of both must be configurated.
  • A test case was added using the name attribute.
  • The documentation was changed adding the name attribute.

Example Usage

Using project_id attribute to query

resource "mongodbatlas_project" "test" {
  name   = "project-name"
  org_id = "<ORG_ID>"

  teams {
    team_id    = "5e0fa8c99ccf641c722fe645"
    role_names = ["GROUP_OWNER"]

  }
  teams {
    team_id    = "5e1dd7b4f2a30ba80a70cd4rw"
    role_names = ["GROUP_READ_ONLY", "GROUP_DATA_ACCESS_READ_WRITE"]
  }
}

data "mongodbatlas_project" "test" {
  project_id = "${mongodbatlas_project.test.id}"
}

Using name attribute to query

resource "mongodbatlas_project" "test" {
  name   = "project-name"
  org_id = "<ORG_ID>"

  teams {
    team_id    = "5e0fa8c99ccf641c722fe645"
    role_names = ["GROUP_OWNER"]

  }
  teams {
    team_id    = "5e1dd7b4f2a30ba80a70cd4rw"
    role_names = ["GROUP_READ_ONLY", "GROUP_DATA_ACCESS_READ_WRITE"]
  }
}

data "mongodbatlas_project" "test" {
  name = "${mongodbatlas_project.test.name}"
}

closes #140

Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

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

Just a few grammar changes where it might impact understanding. Thank you for the quick turnaround!

@PacoDw PacoDw requested a review from themantissa February 20, 2020 19:36
Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

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

Perfect, LGTM

@marinsalinas marinsalinas merged commit 331fe0d into master Feb 20, 2020
@marinsalinas marinsalinas deleted the projects branch February 20, 2020 20:27
@michelzanini
Copy link

This is very nice. I wonder if we can do the same for the Teams data source - be able to look it up by name as well. Now it only supports ID.

@themantissa
Copy link
Collaborator

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

Successfully merging this pull request may close these issues.

Add name argument in mongodbatlas_project datasource
4 participants