# Terraform Module

For users who prefer infrastructure-as-code, we provide an official Terraform module that automates the entire Snowflake Intelligence agent setup.

## Why Use Terraform?

The Terraform module offers several advantages over manual SQL setup:

* **Version Control**: Track infrastructure changes in git
* **Reproducibility**: Easily replicate setup across environments
* **99.9% Automation**: Only 2 SQL commands needed after `terraform apply`
* **Type Safety**: Wrapper functions with proper SQL types included
* **Easy Updates**: Upgrade to new versions with a simple version change

## Quick Start

```hcl
module "euno_agent" {
  source = "github.com/euno-ai/terraform-euno-snowflake-intelligence"

  # Required
  euno_api_key    = var.euno_api_key
  euno_account_id = var.euno_account_id
  warehouse_name  = "YOUR_WAREHOUSE"  # Required - Snowflake warehouse for agent execution
}
```

Then run:

```bash
terraform init
terraform apply
```

After apply, run these two SQL commands in Snowflake:

```sql
-- Create the agent
CALL SNOWFLAKE_INTELLIGENCE.AGENTS.CREATE_EUNO_AGENT();

-- Grant usage to the role
GRANT USAGE ON AGENT SNOWFLAKE_INTELLIGENCE.AGENTS.EUNO_AGENT TO ROLE EUNO_AGENT_USER;
```

That's it! Your Euno agent is ready to use.

## Full Documentation

For complete documentation including:

* All configuration variables
* Customization options
* Architecture details
* Troubleshooting

See the module's README on GitHub:

[**https://github.com/euno-ai/terraform-euno-snowflake-intelligence**](https://github.com/euno-ai/terraform-euno-snowflake-intelligence)

## Prerequisites

* Snowflake account with `ACCOUNTADMIN` role access
* Terraform >= 1.5.0
* Euno API credentials (API key and Account ID)
* Snowflake compute warehouse (required - no default)

## What Gets Created

The Terraform module creates:

| Component          | Count | Notes                                      |
| ------------------ | ----- | ------------------------------------------ |
| Database & Schema  | 1     | `SNOWFLAKE_INTELLIGENCE.AGENTS` by default |
| Network Rule       | 1     | Egress to Euno API Gateway                 |
| API Integration    | 1     | Google API Gateway authentication          |
| External Functions | 12    | For interacting with Euno v2 API           |
| Wrapper Functions  | 12    | Type-safe SQL wrappers                     |
| Role               | 1     | `EUNO_AGENT_USER` with all permissions     |
| Agent Procedure    | 1     | Creates the agent with one call            |

## Choosing Between Terraform and SQL Setup

| Aspect           | Terraform Module         | Manual SQL Setup      |
| ---------------- | ------------------------ | --------------------- |
| Best for         | Teams with IaC practices | Quick one-time setup  |
| Version control  | Built-in                 | Manual                |
| Customization    | Via variables            | Edit SQL directly     |
| Updates          | Change version, re-apply | Re-run updated script |
| State management | Terraform handles it     | Manual tracking       |

## Support

* **GitHub Issues**: [terraform-euno-snowflake-intelligence/issues](https://github.com/euno-ai/terraform-euno-snowflake-intelligence/issues)
* **Email**: <support@euno.ai>
* **Documentation**: [docs.euno.ai](https://docs.euno.ai)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.euno.ai/ai-assistant/snowflake-intelligence-setup/terraform-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
