@@ -13,22 +13,68 @@ resource.
1313
1414An app release represents a combination of code, config vars and add-ons for an app on Heroku.
1515
16+ ## Generation Compatibility
17+
18+ This resource supports both Cedar and Fir generation apps with different artifact types:
19+
20+ * ** Cedar generation apps** : Use ` slug_id ` (traditional slugs)
21+ * ** Fir generation apps** : Use ` oci_image ` (OCI container images)
22+
1623~ > ** NOTE:**
17- This resource requires the slug be uploaded to Heroku using [ ` heroku_slug ` ] ( slug.html )
18- or with external tooling prior to running terraform .
24+ For Cedar apps, the slug must be uploaded to Heroku using [ ` heroku_slug ` ] ( slug.html ) or external tooling.
25+ For Fir apps, the OCI image is typically created by [ ` heroku_build ` ] ( build.html ) and can be promoted between apps .
1926
2027## Example Usage
21- ``` hcl-terraform
22- resource "heroku_app" "foobar" {
23- name = "foobar"
24- region = "us"
28+
29+ ### Cedar Generation (Traditional Slugs)
30+
31+ ``` hcl
32+ resource "heroku_app" "cedar_app" {
33+ name = "my-cedar-app"
34+ region = "us"
2535}
2636
27- # Upload your slug
37+ # Upload your slug using heroku_slug or external tooling
2838
29- resource "heroku_app_release" "foobar-release" {
30- app_id = heroku_app.foobar.id
31- slug_id = "01234567-89ab-cdef-0123-456789abcdef"
39+ resource "heroku_app_release" "cedar_release" {
40+ app_id = heroku_app.cedar_app.id
41+ slug_id = "01234567-89ab-cdef-0123-456789abcdef"
42+ description = "Deploy version 1.2.3"
43+ }
44+ ```
45+
46+ ### Fir Generation (OCI Images)
47+
48+ ``` hcl
49+ resource "heroku_space" "fir_space" {
50+ name = "my-fir-space"
51+ organization = "my-org"
52+ region = "virginia"
53+ generation = "fir"
54+ }
55+
56+ resource "heroku_app" "fir_app" {
57+ name = "my-fir-app"
58+ region = heroku_space.fir_space.region
59+ space = heroku_space.fir_space.name
60+ organization {
61+ name = heroku_space.fir_space.organization
62+ }
63+ }
64+
65+ # Build creates an OCI image in Fir generation
66+ resource "heroku_build" "fir_build" {
67+ app_id = heroku_app.fir_app.id
68+ source {
69+ path = "."
70+ }
71+ }
72+
73+ # Promote the OCI image to another app or environment
74+ resource "heroku_app_release" "fir_release" {
75+ app_id = heroku_app.fir_app.id
76+ oci_image = "7f668938-7999-48a7-ad28-c24cbd46c51b" # From build or promotion
77+ description = "Deploy version 1.2.3 with CNB"
3278}
3379```
3480
@@ -37,16 +83,91 @@ resource "heroku_app_release" "foobar-release" {
3783The following arguments are supported:
3884
3985* ` app_id ` - (Required) Heroku app ID (do not use app name)
40- * ` slug_id ` - unique identifier of slug
41- * ` description ` - description of changes in this release
86+ * ` slug_id ` - (Optional) Unique identifier of slug. Required for Cedar generation apps. Conflicts with ` oci_image ` .
87+ * ` oci_image ` - (Optional) OCI image identifier (UUID or SHA256 digest). Required for Fir generation apps. Conflicts with ` slug_id ` .
88+ * ` description ` - (Optional) Description of changes in this release
89+
90+ ### Artifact Type Requirements
91+
92+ Exactly one artifact type must be specified based on your app's generation:
93+
94+ | Generation | Required Field | Field Type | Example |
95+ | ------------| ----------------| ------------| ---------|
96+ | Cedar | ` slug_id ` | UUID | ` "01234567-89ab-cdef-0123-456789abcdef" ` |
97+ | Fir | ` oci_image ` | UUID or SHA256 | ` "7f668938-7999-48a7-ad28-c24cbd46c51b" ` or ` "sha256:abc123..." ` |
4298
4399## Attributes Reference
44100
45101The following attributes are exported:
46102
47103* ` id ` - The ID of the app release
104+ * ` slug_id ` - The slug ID (for Cedar generation apps)
105+ * ` oci_image ` - The OCI image identifier (for Fir generation apps)
106+
107+ ## Validation
108+
109+ The provider automatically validates that the correct artifact type is used for your app's generation:
110+
111+ * ** Cedar apps** : Must use ` slug_id ` , cannot use ` oci_image `
112+ * ** Fir apps** : Must use ` oci_image ` , cannot use ` slug_id `
113+
114+ If you specify the wrong artifact type, you'll receive a clear error message during ` terraform plan ` .
115+
116+ ## OCI Image Formats
117+
118+ The ` oci_image ` field accepts multiple formats:
119+
120+ * ** UUID format** : ` "7f668938-7999-48a7-ad28-c24cbd46c51b" ` (most common)
121+ * ** SHA256 with prefix** : ` "sha256:abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" `
122+ * ** Bare SHA256** : ` "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" `
123+
124+ ## Best Practices
125+
126+ ### Artifact Promotion Workflow
127+
128+ 1 . ** Build once** : Create your build in one environment
129+ 2 . ** Promote everywhere** : Use ` heroku_app_release ` to deploy the same artifact to other environments
130+ 3 . ** Immutable artifacts** : Never modify artifacts, always create new ones for changes
131+
132+ ### Cedar Example Workflow
133+ ``` hcl
134+ # 1. Upload slug (external process)
135+ # 2. Deploy to staging
136+ resource "heroku_app_release" "staging" {
137+ app_id = heroku_app.staging.id
138+ slug_id = var.slug_id
139+ }
140+
141+ # 3. Promote to production
142+ resource "heroku_app_release" "production" {
143+ app_id = heroku_app.production.id
144+ slug_id = var.slug_id # Same slug as staging
145+ }
146+ ```
147+
148+ ### Fir Example Workflow
149+ ``` hcl
150+ # 1. Build in development
151+ resource "heroku_build" "dev_build" {
152+ app_id = heroku_app.development.id
153+ source { path = "." }
154+ }
155+
156+ # 2. Promote to staging
157+ resource "heroku_app_release" "staging" {
158+ app_id = heroku_app.staging.id
159+ oci_image = var.oci_image_id # From dev build
160+ }
161+
162+ # 3. Promote to production
163+ resource "heroku_app_release" "production" {
164+ app_id = heroku_app.production.id
165+ oci_image = var.oci_image_id # Same OCI image
166+ }
167+ ```
48168
49169## Import
170+
50171The most recent app release can be imported using the application name.
51172
52173For example:
0 commit comments