|
| 1 | +--- |
| 2 | +subcategory: "MongoDB" |
| 3 | +page_title: "Scaleway: scaleway_mongodb_instance" |
| 4 | +--- |
| 5 | + |
| 6 | +# scaleway_mongodb_instance |
| 7 | + |
| 8 | +Gets information about a MongoDB Instance. |
| 9 | + |
| 10 | +For further information refer to the Managed Databases for MongoDB [API documentation](https://developers.scaleway.com/en/products/mongodb/api/) |
| 11 | + |
| 12 | +## Example Usage |
| 13 | + |
| 14 | +```hcl |
| 15 | +# Get info by name |
| 16 | +data "scaleway_mongodb_instance" "my_instance" { |
| 17 | + name = "foobar" |
| 18 | +} |
| 19 | +
|
| 20 | +# Get info by instance ID |
| 21 | +data "scaleway_mongodb_instance" "my_instance" { |
| 22 | + instance_id = "11111111-1111-1111-1111-111111111111" |
| 23 | +} |
| 24 | +
|
| 25 | +# Get other attributes |
| 26 | +output "mongodb_version" { |
| 27 | + description = "Version of the MongoDB instance" |
| 28 | + value = data.scaleway_mongodb_instance.my_instance.version |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +## Argument Reference |
| 33 | + |
| 34 | +- `name` - (Optional) The name of the MongoDB instance. |
| 35 | + |
| 36 | +- `instance_id` - (Optional) The MongoDB instance ID. |
| 37 | + |
| 38 | + -> **Note** You must specify at least one: `name` or `instance_id`. |
| 39 | + |
| 40 | +- `project_id` - (Optional) The ID of the project the MongoDB instance is in. Can be used to filter instances when using `name`. |
| 41 | + |
| 42 | +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#zones) in which the MongoDB Instance exists. |
| 43 | + |
| 44 | +- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the MongoDB instance is in. |
| 45 | + |
| 46 | +## Attributes Reference |
| 47 | + |
| 48 | +In addition to all above arguments, the following attributes are exported: |
| 49 | + |
| 50 | +- `id` - The ID of the MongoDB Instance. |
| 51 | +- `name` - The name of the MongoDB instance. |
| 52 | +- `version` - The version of MongoDB running on the instance. |
| 53 | +- `node_type` - The type of MongoDB node. |
| 54 | +- `node_number` - The number of nodes in the MongoDB cluster. |
| 55 | +- `created_at` - The date and time the MongoDB instance was created. |
| 56 | +- `project_id` - The ID of the project the instance belongs to. |
| 57 | +- `tags` - A list of tags attached to the MongoDB instance. |
| 58 | +- `volume_type` - The type of volume attached to the MongoDB instance. |
| 59 | +- `volume_size_in_gb` - The size of the attached volume, in GB. |
| 60 | +- `public_network` - The details of the public network configuration, if applicable. |
| 61 | + |
| 62 | +## Import |
| 63 | + |
| 64 | +MongoDB™ instance can be imported using the `id`, e.g. |
| 65 | + |
| 66 | +```bash |
| 67 | +terraform import scaleway_mongodb_instance.main fr-par-1/11111111-1111-1111-1111-111111111111 |
| 68 | +``` |
0 commit comments