Skip to content

Commit

Permalink
Merge pull request #18 from axiomhq/mano/update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
toppercodes authored Apr 3, 2024
2 parents 1045068 + e38ba2a commit 8ad1097
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 38 deletions.
72 changes: 44 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,66 @@
# Axiom Terraform Provider

The axiom providers allows you to create and manage datasets in Axiom.
A Terraform provider that allows you to manage resources in [Axiom](https://axiom.co/).

## Usage
Axiom lets you make the most of your event data without compromises: all your data, all the time, for all possible needs. Say goodbye to data sampling, waiting times, and hefty fees.

import the provider
📖 For more information, see the [documentation](https://registry.terraform.io/providers/axiomhq/axiom/latest/docs).

```hcl
terraform {
required_providers {
axiom = {
source = "axiom-provider"
🔧 To see the provider in action, check out the [example](example/main.tf).

❓ Issues or feedback? [Contact us](https://axiom.co/contact) or [join the Axiom Discord community](https://axiom.co/discord).

## Prerequisites

- [Sign up for a free Axiom account](https://app.axiom.co/register). All you need is an email address.
- [Create an API token in Axiom with permissions to query and ingest data](https://axiom.co/docs/reference/settings#access-overview).

## Install the provider

To install the Axiom Terraform Provider from the [Terraform Registry](https://registry.terraform.io/providers/axiomhq/axiom/latest), follow these steps:

1. Add the following code to your Terraform configuration file. Replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable.

```hcl
terraform {
required_providers {
axiom = {
source = "axiomhq/axiom"
}
}
}
}
}
```
configure the provider with your personal API token and organization ID
provider "axiom" {
api_token = "API_TOKEN"
}
```
```hcl
provider "axiom" {
api_token = "your_personal_api_token_here"
org_id = "organization_id_here"
}
```
2. In your terminal, go to the folder of your main Terraform configuration file, and then run the command `terraform init`.
## Create a dataset
finally, create dataset resources
To create a dataset in Axiom using the provider, add the following code to your Terraform configuration file:
```hcl
resource "axiom_dataset" "example" {
name = "example"
description = "an example dataset created by terraform"
description = "This is an example dataset created by Terraform."
}
```

or, create a dataset datasource to reference an existing dataset
## Access existing dataset

To access an existing dataset in Axiom using the provider, follow these steps:

1. Determine the ID of the Axiom dataset using the [`getDatasets` query of the Axiom API](https://axiom.co/docs/restapi/endpoints/getDatasets).
2. Add the following code to your Terraform configuration file. Replace `DATASET_ID` with the ID of the Axiom dataset.

```hcl
data "axiom_dataset" "testing_ds" {
id = "testing"
data "axiom_dataset" "testing_dataset" {
id = "DATASET_ID"
}
```

For more examples, checkout the [example directory](example/main.tf)


## Development
## License

The axiom provider utilizes axiom-go sdk under the hood.
For more information on licensing, see [LICENSE](./LICENSE).
71 changes: 61 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,68 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "axiom Provider"
subcategory: ""
description: |-
---
# Axiom Provider

# axiom Provider
A Terraform provider that allows you to manage resources in [Axiom](https://axiom.co/).

Axiom lets you make the most of your event data without compromises: all your data, all the time, for all possible needs. Say goodbye to data sampling, waiting times, and hefty fees.

📖 For more information, see the [documentation](https://registry.terraform.io/providers/axiomhq/axiom/latest/docs).

🔧 To see the provider in action, check out the [example](example/main.tf).

❓ Issues or feedback? [Contact us](https://axiom.co/contact) or [join the Axiom Discord community](https://axiom.co/discord).

For more information about the available resources and data sources, use the left navigation.

## Prerequisites

- [Sign up for a free Axiom account](https://app.axiom.co/register). All you need is an email address.
- [Create an API token in Axiom with permissions to query and ingest data](https://axiom.co/docs/reference/settings#access-overview).

## Install the provider

To install the Axiom Terraform Provider from the [Terraform Registry](https://registry.terraform.io/providers/axiomhq/axiom/latest), follow these steps:

1. Add the following code to your Terraform configuration file. Replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable.

```hcl
terraform {
required_providers {
axiom = {
source = "axiomhq/axiom"
}
}
}
provider "axiom" {
api_token = "API_TOKEN"
}
```
2. In your terminal, go to the folder of your main Terraform configuration file, and then run the command `terraform init`.
## Create a dataset
To create a dataset in Axiom using the provider, add the following code to your Terraform configuration file:
```hcl
resource "axiom_dataset" "example" {
name = "example"
description = "This is an example dataset created by Terraform."
}
```

## Access existing dataset

To access an existing dataset in Axiom using the provider, follow these steps:

1. Determine the ID of the Axiom dataset using the [`getDatasets` query of the Axiom API](https://axiom.co/docs/restapi/endpoints/getDatasets).
2. Add the following code to your Terraform configuration file. Replace `DATASET_ID` with the ID of the Axiom dataset.

```hcl
data "axiom_dataset" "testing_dataset" {
id = "DATASET_ID"
}
```

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

### Required
Expand All @@ -24,7 +74,8 @@ description: |-

- `base_url` (String) The base url of the axiom api.

# Example
## Example

```terraform
terraform {
required_providers {
Expand Down

0 comments on commit 8ad1097

Please sign in to comment.