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

docs: update get started example #1827

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions examples/get-started/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Get started with Aiven Provider for Terraform

Set up your organization on Aiven and create your first Aiven project and user group.
Set up your organization on Aiven, and create your first project and user group.

This example creates a project and user group in your organization, and gives the user group access to the project. You can add users who have already accepted the invite to your organization to the group. When you add groups to projects, you can give them the `admin` `developer`, `operator`, or `read_only` [project role](https://aiven.io/docs/platform/reference/project-member-privileges).
This example creates a project and user group in your organization, and gives the group access to the project. You can add users who are already part of your organization. Users can be added in the Aiven Console either manually by [sending them an invite](https://aiven.io/docs/platform/howto/manage-org-users), or you can [create managed users](https://aiven.io/docs/platform/concepts/managed-users) by verifying a domain and setting up an identity provider.

When you add groups to projects, you can give them the `admin` `developer`, `operator`, or `read_only` [project role](https://aiven.io/docs/platform/reference/project-member-privileges).

## Prerequisites

* [Install Terraform](https://www.terraform.io/downloads)
* [Sign up for Aiven](https://console.aiven.io/signup?utm_source=github&utm_medium=organic&utm_campaign=devportal&utm_content=repo)
* [Create an authentication token](https://docs.aiven.io/docs/platform/howto/create_authentication_token.html)
* [Create a token](https://docs.aiven.io/docs/platform/howto/create_authentication_token.html)
* Add users to your organization by [inviting them](https://aiven.io/docs/platform/howto/manage-org-users) or by [creating managed users](https://aiven.io/docs/platform/concepts/managed-users)

## Create your first Aiven resources

Expand All @@ -27,7 +30,7 @@ Terraform v1.6.2

2. Clone this repository.

3. Replace the placeholders in the `get-started.tf` file. It's recommended to use your organization name as a prefix for the project name.
3. Replace the placeholders `ORGANIZATION_NAME` and `USER_ID` in the `get-started.tf` file. It's recommended to use your organization name as a prefix for the project name.

4. Initialize Terraform:

Expand Down Expand Up @@ -93,7 +96,7 @@ Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

## Verify the changes in the Aiven Console

You can see your project and user group in the [Aiven Console](https://console.aiven.io/):
To view your project and user group in the [Aiven Console](https://console.aiven.io/):

1. In the organization, click **Projects** and select your project.

Expand Down
22 changes: 11 additions & 11 deletions examples/get-started/get-started.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@ terraform {
}
}

variable "aiven_api_token" {}
variable "aiven_token" {}


provider "aiven" {
api_token = var.aiven_api_token
api_token = var.aiven_token
}

# Your organization
data "aiven_organization" "org" {
name = "YOUR_ORGANIZATION_NAME"
data "aiven_organization" "main" {
name = "ORGANIZATION_NAME"
}

# Create a project in your organization
resource "aiven_project" "example-project" {
resource "aiven_project" "example_project" {
project = "ORGANIZATION_NAME-first-project"
parent_id = data.aiven_organization.org.id
parent_id = data.aiven_organization.main.id
}

# Create a user group
resource "aiven_organization_user_group" "group" {
organization_id = data.aiven_organization.org.id
resource "aiven_organization_user_group" "example_group" {
organization_id = data.aiven_organization.main.id
name = "Example user group"
description = "The first user group for this organization."
}

# Add an existing organization user to the group
resource "aiven_organization_user_group_member" "group-members" {
group_id = aiven_organization_user_group.group.group_id
organization_id = data.aiven_organization.org.id
group_id = aiven_organization_user_group.example_group.group_id
organization_id = data.aiven_organization.main.id
user_id = "USER_ID"
}

# Give the group access to your project with the developer role
resource "aiven_organization_group_project" "group-proj" {
group_id = aiven_organization_user_group.group.group_id
project = aiven_project.example-project.project
project = aiven_project.example_project.project
role = "developer"
}

Loading