Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 15 additions & 3 deletions docs/data-sources/account.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "datafy_account Data Source - datafy"
subcategory: ""
description: |-
Retrieves a specific Datafy account.
Retrieves information about an existing Datafy account.
---

# datafy_account (Data Source)

Retrieves a specific Datafy account.
Use this data source to retrieve information about an existing Datafy account. This is useful when you need to reference an account that was created outside of Terraform or in a different Terraform configuration.

## Example Usage

Expand All @@ -18,6 +17,19 @@ data "datafy_account" "example" {
}
```

### Use with Other Resources

```terraform
data "datafy_account" "existing" {
id = "79c406c5-7b64-43f2-ba76-9b01e74e3d90"
}

resource "datafy_role_arn" "example" {
account_id = data.datafy_account.existing.id
arn = "arn:aws:iam::123456789012:role/DatafyRole"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/autoscaling_rule.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "datafy_autoscaling_rule Data Source - datafy"
subcategory: ""
description: |-
Retrieves a specific Datafy Autoscaling Rule.
Retrieves information about an existing Datafy autoscaling rule.
---

# datafy_autoscaling_rule (Data Source)

Retrieves a specific Datafy Autoscaling Rule.
Use this data source to retrieve information about an existing Datafy autoscaling rule. This is useful when you need to reference a rule that was created outside of Terraform or in a different Terraform configuration.

## Example Usage

Expand Down
7 changes: 3 additions & 4 deletions docs/data-sources/role_arn.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "datafy_role_arn Data Source - datafy"
subcategory: ""
description: |-
Retrieves a specific Datafy role ARN.
Retrieves the AWS IAM role ARN associated with a Datafy account.
---

# datafy_role_arn (Data Source)

Retrieves a specific Datafy role ARN.
Use this data source to retrieve the AWS IAM role ARN associated with an existing Datafy account. This is useful when you need to reference the IAM role that was configured outside of Terraform or in a different Terraform configuration.

## Example Usage

```terraform
data "datafy_rolearn" "example" {
data "datafy_role_arn" "example" {
account_id = "79c406c5-7b64-43f2-ba76-9b01e74e3d90"
}
```
Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/token.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "datafy_token Data Source - datafy"
subcategory: ""
description: |-
Retrieves a specific Datafy token.
Retrieves information about an existing Datafy access token.
---

# datafy_token (Data Source)

Retrieves a specific Datafy token.
Use this data source to retrieve information about an existing Datafy access token. This returns metadata about the token (description, role IDs, expiration) but **not** the token secret.

## Example Usage

Expand Down
62 changes: 57 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,75 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "datafy Provider"
page_title: "Datafy Provider"
subcategory: ""
description: |-

The Datafy provider enables Terraform to manage Datafy accounts, IAM role associations, access tokens, and autoscaling rules.
---

# datafy Provider
# Datafy Provider

The Datafy provider allows you to manage your [Datafy](https://docs.datafy.io) infrastructure as code using Terraform. With this provider you can create and manage accounts, associate AWS IAM roles, generate access tokens, and configure autoscaling rules.

## Prerequisites

Before using the Datafy Terraform provider, you need:

1. **An organization account** — Your organization account must be set up by the Datafy team. Contact Datafy to get started.
2. **An API token** — Once your organization account is ready, generate an API token from the [Datafy UI](https://docs.datafy.io). This token authenticates the provider with the Datafy API.

## Getting Started

1. Configure the provider with your API token.
2. Create one or more **accounts** (`datafy_account`) to represent your cloud environments.
3. Associate an **IAM role** (`datafy_role_arn`) with each account so Datafy can access your AWS resources.
4. Optionally, create **access tokens** (`datafy_token`) for programmatic API access.
5. Optionally, define **autoscaling rules** (`datafy_autoscaling_rule`) to control which resources are managed by Datafy's autoscaler.

## Resource Relationships

```
Organization (authenticated via provider token)
└── Account (datafy_account)
├── IAM Role (datafy_role_arn) — one per account
├── Access Tokens (datafy_token) — zero or more per account
└── Autoscaling Rules (datafy_autoscaling_rule) — zero or more per account
```

- Each **account** belongs to your organization and is identified by a unique ID.
- Each account can have exactly **one IAM role ARN** associated with it. This role grants Datafy permissions to manage resources in the corresponding AWS account.
- Each account can have multiple **access tokens** for programmatic API access.
- Each account can have multiple **autoscaling rules** that define which resources the Datafy autoscaler should manage.

## Example Usage

```terraform
provider "datafy" {
token = "eZa0qICnUV-COvO46NfDysUDN4bFKMeWssXVCIsIIn0.eyJzdW"
# The token can also be set via the DATAFY_TOKEN environment variable.
token = var.datafy_token
}
```

## Authentication

The provider requires an API token for authentication. You can provide it in two ways:

1. **In the provider configuration** (not recommended for production — avoid committing tokens to version control):

```terraform
provider "datafy" {
token = "your-api-token"
}
```

2. **Via environment variable** (recommended):

```bash
export DATAFY_TOKEN="your-api-token"
```

```terraform
provider "datafy" {}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand Down
42 changes: 39 additions & 3 deletions docs/resources/account.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,51 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "datafy_account Resource - datafy"
subcategory: ""
description: |-
Create a Datafy account
Manages a Datafy account. Accounts represent cloud environments within your organization.
---

# datafy_account (Resource)

Create a Datafy account
Manages a Datafy account. Accounts are the primary organizational unit in Datafy and represent a cloud environment (e.g., production, staging, development) within your organization.

Each account can have an associated [IAM role](role_arn.md) for AWS access, [access tokens](token.md) for programmatic API access, and [autoscaling rules](autoscaling_rule.md) for controlling the Datafy autoscaler.

For more information, see the [Datafy documentation](http://docs.datafy.io).

## Example Usage

### Basic Account

```terraform
resource "datafy_account" "example" {
name = "example-account"
}
```

### Account with IAM Role and Token

```terraform
# Create an account
resource "datafy_account" "production" {
name = "production"
}

# Associate an IAM role with the account
resource "datafy_role_arn" "production" {
account_id = datafy_account.production.id
arn = "arn:aws:iam::123456789012:role/DatafyRole"
}

# Create an access token for the account
resource "datafy_token" "production" {
account_id = datafy_account.production.id
description = "CI/CD pipeline token"
ttl = "720h"
role_ids = ["admin"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand All @@ -29,3 +57,11 @@ resource "datafy_account" "example" {

- `id` (String) The unique identifier of the Datafy account.
- `parent_account_id` (String) The unique identifier of the parent Datafy account

## Import

Accounts can be imported using the account ID:

```shell
terraform import datafy_account.example 79c406c5-7b64-43f2-ba76-9b01e74e3d90
```
Loading
Loading