Manage Stripe resources with infrastructure as code
commercial software
Stripe's official Terraform provider, published as stripe/stripe on the Terraform Registry, manages Stripe objects from declarative configuration: products, prices, coupons, promotion codes, shipping and tax rates, entitlement features, customers, billing meters, webhook endpoints and event destinations (webhooks or Amazon EventBridge). Stripe generates it from its API specification with its own tooling, and its README also lists ephemeral resources and actions for refunds, payouts, transfers and token creation. Stripe's docs suggest Terraform workspaces with a sandbox key and a live key to keep test and production state apart, and lower parallelism to stay within Stripe's rate limits.
Problems it solves
- define the URLs Stripe sends our events to in code, reviewed like the rest of our infrastructure
- keep Stripe products and prices in version control and review changes in pull requests
- create the same Stripe catalog in sandbox and live mode from one configuration
- set up Stripe coupons and promotion codes as code for a launch
- provision a billing meter and a metered price for usage-based billing with Terraform
- point Stripe events at Amazon EventBridge from our infrastructure code
- stop drift between our staging and production Stripe accounts' webhook settings
- define tax rates and shipping rates for our store in code
- pin the Stripe API version our webhook endpoint receives events in, in Terraform
Features
- resources: stripe_product, stripe_price, stripe_coupon, stripe_promotion_code, stripe_shipping_rate, stripe_tax_rate, stripe_entitlements_feature
- resources: stripe_customer, stripe_webhook_endpoint, stripe_billing_meter, stripe_v2_core_event_destination
- Billing v2 pricing plan, rate card and metered item resources (private preview)
- stripe_billing_meter data source
- ephemeral resources and actions for refunds, payouts, transfers and tokens
- API key from the STRIPE_API_KEY environment variable or the provider block
- generated from Stripe's OpenAPI specification
