Manage AI Object Storage with Terraform
Use Terraform to manage CoreWeave AI Object Storage infrastructure as code
Terraform providers are essential plugins that enable Terraform to manage infrastructure resources on various platforms.
You can use Terraform to manage access policies and configure bucket lifecycles and versioning. As CoreWeave AI Object Storage is S3-compatible, you can manage it using either the CoreWeave Terraform provider or the official Terraform AWS Provider. Both providers translate Terraform's declarative syntax into S3-compatible API calls.
If you want to manage data and objects, you can use any S3-compatible tool to manage your data. See How-To: Manage Objects to learn how to use CoreWeave AI Object Storage with s3cmd, Boto3, or the AWS CLI.
Configure Terraform
These examples show how to set up the Terraform provider with CoreWeave AI Object Storage. For LOTA, set the s3_endpoint to http://cwlota.com.
The AWS provider example configuration includes the required overrides for compatibility with CoreWeave AI Object Storage, while the native CoreWeave provider example configuration does not require these overrides.
- CoreWeave Provider
- AWS Provider
1terraform {2required_providers {3coreweave = {4source = "coreweave/coreweave"5version = ">= 0.3.0"6}7}8required_version = ">= 1.2.0"9}1011provider "coreweave" {12token = env.COREWEAVE_API_TOKEN13s3_endpoint = env.COREWEAVE_S3_ENDPOINT # If using LOTA, set to http://cwlota.com14}15
Some aspects to note in this example:
tokenis set as an environment variable for security. Get your API access token from the CoreWeave Access Tokens page in Cloud Console.s3_endpointdefaults tohttps://cwobject.com, which is the primary CoreWeave AI Object Storage endpoint. If using LOTA, set tohttp://cwlota.com.versionis set to>= 0.3.0because0.3.0is the first version to support AI Object Storage.
1terraform {2required_providers {3aws = {4source = "hashicorp/aws"5version = "5.67.0"6}7}89required_version = ">= 1.2.0"10}1112provider "aws" {13access_key = env.AWS_ACCESS_KEY14secret_key = env.AWS_ACCESS_SECRET15region = local.region1617# These two values must be true so Terraform doesn't attempt STS authentication.18skip_credentials_validation = true19skip_requesting_account_id = true2021# CoreWeave uses different region names, so validation must be skipped.22skip_region_validation = true23s3_use_path_style = false2425endpoints {26s3 = local.endpoint27}28}2930locals {31region = "US-EAST-03A"32endpoint = "https://cwobject.com"33}34
Some aspects to note in this example, highlighted above:
access_keyandsecret_keyare set as environment variables for security.skip_credentials_validation,skip_requesting_account_id, andskip_region_validationoptions are set totrueto bypass AWS-specific validation checks.- In this example,
regionis set toUS-EAST-03A. Note that CoreWeave AI Object Storage uses different region names than AWS. endpointis set tohttps://cwobject.com, which is the CoreWeave AI Object Storage endpoint.- The
s3_use_path_styleoption is set tofalseto use virtual-hosted-style URLs.
Object Storage resources
You can use Terraform to manage organization access policies and bucket access policies, and configure bucket lifecycles and versioning. The CoreWeave provider includes the following Object Storage resources and data sources:
Resources:
coreweave_object_storage_bucketcoreweave_object_storage_bucket_lifecycle_configurationcoreweave_object_storage_bucket_policycoreweave_object_storage_bucket_versioningcoreweave_object_storage_organization_access_policy
Data sources:
coreweave_object_storage_bucket_policy_document
For detailed examples and documentation, see the CoreWeave provider registry documentation.
Additional resources
- To learn more about using the Terraform AWS provider with Object Storage, see the S3 section of the official documentation.
- To learn more about the CoreWeave Terraform provider, see the CoreWeave provider documentation.
- Use the CoreWeave provider in your OpenTofu configuration.