Skip to content

Commit fcb2977

Browse files
heroku-johnnySandyPantsLaimarsheicheng18
authored
Fir Compatibility Branch (#408)
* Add Fir generation support for Heroku Private Spaces (#401) * Include .cursor in gitignore * Add foundational feature matrix system for generation support - Implement IsFeatureSupported() helper function for Cedar/Fir generation differences - Add feature matrix tracking space capabilities across generations - Include comprehensive test coverage with 14 test cases - Cedar generation: supports all space features including shield spaces - Fir generation: supports private spaces only, shield spaces unsupported - Foundation for graceful handling of generation-specific feature differences * Add Fir generation support for Private Spaces - Add generation field to heroku_space resource with cedar/fir validation - Implement shield feature validation blocking Fir+Shield combinations - Add comprehensive CRUD validation (Create errors, Read warnings) - Enhance feature matrix with complete space feature coverage - Add extensive test suite: 24 tests including acceptance tests - Update documentation with generation examples and guidance - Maintain backward compatibility with cedar default - Foundation for incremental space feature validation Resolves core deliverables for Fir Private Space compatibility. Generated shield spaces require cedar generation. ForceNew ensures generation cannot be changed after creation. * Improve generation validation with plan-time error checking - Add CustomizeDiff function for shield+generation validation during plan phase - Users now get immediate feedback during 'terraform plan' instead of waiting for apply - Remove redundant validation from Create function since CustomizeDiff handles it - Better UX: clear error messages during planning prevent surprises during apply * Document outbound IPs limitation for Fir generation - Add note to space documentation that outbound IP management is not supported for fir generation spaces - Provides clear guidance to users about generation differences * Optimize Fir space acceptance tests to use single space pattern - Consolidate TestAccHerokuSpace_Generation from 3 spaces to 1 space - Create new TestAccHerokuSpace_Fir following efficient single-space pattern - Remove TestAccHerokuSpace_GenerationForceNew (redundant with generation change test) - Add Fir-specific validation test steps for VPN/inbound/peering failures - Reduces space creations from 6 to 2 (~70% faster test execution) - Follows established pattern from main TestAccHerokuSpace function * Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update heroku/resource_heroku_space.go Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> Update docs/resources/space.md Co-authored-by: Sandy Lai <[email protected]> Signed-off-by: Johnny Winn <[email protected]> * Pass generation field to Heroku API for space creation - Add generation field to SpaceCreateOpts when creating spaces - Fix resourceHerokuSpaceRead to properly read generation from API response - Ensure users get the generation they specify instead of defaulting to Cedar - Add debug logging for space creation with generation - Tested: Cedar space creation confirmed working, Fir space API correctly validates generation * Remove default value for CIDR from spaces * Include the fir feature branch for acceptance test runs * Remove generation name check * Remove unused test steps --------- Signed-off-by: Johnny Winn <[email protected]> Co-authored-by: Sandy Lai <[email protected]> * Add Fir generation support for Heroku Apps (#402) * Add foundational feature matrix system for generation support - Implement IsFeatureSupported() helper function for Cedar/Fir generation differences - Add feature matrix tracking space capabilities across generations - Include comprehensive test coverage with 14 test cases - Cedar generation: supports all space features including shield spaces - Fir generation: supports private spaces only, shield spaces unsupported - Foundation for graceful handling of generation-specific feature differences * Add generation support to apps with CNB validation and acceptance tests * Refactor app generation to be computed from space Major UX improvement: generation is now automatically determined from the space the app is deployed to, rather than user-configured. Changes: - App 'generation' field is now computed-only (was optional) - Apps in Fir spaces automatically get generation = 'fir' - Apps in Cedar spaces (or no space) get generation = 'cedar' Core Improvements: - Fix CNB buildpack errors by conditionally querying based on generation - Smart buildpack handling: skip traditional queries for Fir apps - Automatic space generation detection via SpaceInfo API - Better error prevention and more intuitive configuration Test Improvements: - Consolidate acceptance tests with single space approach - Remove invalid validation tests (no longer user-configurable) - Update test expectations for computed generation behavior - Maintain comprehensive coverage for both generations Documentation Updates: - Update examples to show space-based generation approach - Clarify that generation is computed from space deployment - Improve migration guide with proper space-first workflow - Update argument/attribute references for computed field * Update docs/resources/app.md Co-authored-by: Mars Hall <[email protected]> Signed-off-by: Johnny Winn <[email protected]> * Optimize app generation detection by using AppInfo response - Use app.Generation.Name directly from AppInfo response instead of making separate SpaceInfo API call - Remove unnecessary getSpaceGeneration() function and SpaceInfo API request - Maintains same functionality with better performance and fewer API calls - Addresses PR feedback about unnecessary API requests --------- Signed-off-by: Johnny Winn <[email protected]> Co-authored-by: Mars Hall <[email protected]> * Add Fir generation validation for `heroku_build` resource (#406) * Add Fir generation validation for heroku_build resource Validates that buildpacks cannot be specified for Fir generation apps, which use Cloud Native Buildpacks configured via project.toml instead. - Add plan-time and apply-time validation for buildpack compatibility - Add comprehensive unit and acceptance tests - Update documentation with generation-specific examples - Add build features to generation feature matrix * refactor: Use shared Fir space for build generation tests - Remove standalone TestAccHerokuBuild_Generation test - Add testStep_AccHerokuBuild_Generation_FirValid and FirInvalid helpers - Integrate build tests into existing TestAccHerokuSpace_Fir - Follow existing test pattern for efficiency and consistency * Resolve resource name conflicts in build generation tests - Use unique resource names between test steps to prevent conflicts - fir_build_app_valid vs fir_build_app_invalid - Different app name patterns for each test step - Fixes 'plan was not empty' acceptance test failure * Add Fir generation support to heroku_app_release (#407) * feat: enhance pipeline coupling errors for mixed generations (#409) - Add contextual error messages when coupling apps from different generations - Include app name and generation in error output for better UX - Update pipeline documentation with generation compatibility requirements Addresses mixed-generation pipeline error handling work item. * Add new Pipeline Promotion resource (#410) * Add heroku_pipeline_promotion resource * Update heroku-go API client to add support for Promoting by Release ID * Enable release_id support for pipeline promotions - Flow team has added Promotion#release_id API support - Remove error check that blocked release_id usage - Add release_id to API call when provided - Update documentation with release_id examples and remove outdated notes - Remove obsolete unit test for release_id validation - Pipeline promotions now support both latest and specific release promotion - Validated with local terraform config - both promotion types work perfectly * Make release_id required for pipeline promotions - Change release_id from Optional to Required in schema - Remove conditional logic in Create function since release_id is always present - Update documentation to reflect required field - Update unit test to validate release_id as required field - Simplify examples and descriptions to focus on specific release promotion - This provides clearer, more predictable behavior for users * Fix flaky VPN connection test - make tunnel count flexible - Change from exact tunnel count check (tunnels.# = 2) to attribute existence check - VPN tunnel provisioning can be delayed in test environments - Still validates VPN connection creation and tunnels field presence - Resolves consistent test failures across multiple PRs where tunnels.# expected 2 got 0 - This test failure was blocking unrelated PRs (telemetry drains, pipeline promotions) --------- Co-authored-by: Mars Hall <[email protected]> * Add new Telemetry Drain resource (#411) * Add new heroku_telemetry_drain resource for fir generation * Fix telemetry drain acceptance test configuration - Changed space-scoped drain from logs-only to traces+metrics - Updated endpoint from otlp to otlphttp format - Resolves API parameter validation error in acceptance tests * Remove space-scoped drain from acceptance test - Space-scoped telemetry drains encounter API validation issues - Simplified to test only app-scoped drains which work reliably - Acceptance test now passes both locally and on CI * Make headers required for telemetry drains and add space-scoped drain test - API testing revealed headers are required for all telemetry drains - Updated schema to make headers required instead of optional - Added space-scoped telemetry drain back to acceptance test with headers - Updated documentation to reflect headers requirement - Both app-scoped and space-scoped drains now work correctly * Fix acceptance test issues for telemetry drains - Remove problematic Fir build invalid test from space test to avoid app creation limits - Fix unit test to expect headers field as required (matching schema) - Update build test error pattern to match full validation message - Telemetry drain tests are the focus of this branch, build tests are covered elsewhere * Fix flaky VPN connection test - make tunnel count flexible - Change from exact tunnel count check (tunnels.# = 2) to attribute existence check - VPN tunnel provisioning can be delayed in test environments - Still validates VPN connection creation and tunnels field presence - Resolves consistent test failures across multiple PRs where tunnels.# expected 2 got 0 - This test failure was blocking unrelated PRs (telemetry drains, pipeline promotions) * Doc updates for Fir/CNBs (#413) * Update app.md Signed-off-by: Sandy Lai <[email protected]> * Update app.md Signed-off-by: Sandy Lai <[email protected]> * Update app.md Signed-off-by: Sandy Lai <[email protected]> * Update build.md Update for style, de-emphasize CNBs=Fir, add Optional to buildpacks text definition for CNBs, change mentions of slug where appropriate to artifact, add note that slug_id is only for apps with classic buildpacks. Signed-off-by: Sandy Lai <[email protected]> * Update build.md fix typo Signed-off-by: Sandy Lai <[email protected]> * Plain english guidelines updates app.md Signed-off-by: Sandy Lai <[email protected]> * rephrase note as positive app.md Signed-off-by: Sandy Lai <[email protected]> * Update space.md to use plain technical English Signed-off-by: Sandy Lai <[email protected]> * Update space.md Signed-off-by: Sandy Lai <[email protected]> * Update pipeline.md to plain technical English, change slug to artifacts Signed-off-by: Sandy Lai <[email protected]> * Peer review terraform docs (#412) * Peer review on app.md Signed-off-by: Helen Cheng <[email protected]> * Peer review for build.md Signed-off-by: Helen Cheng <[email protected]> * Peer review for pipeline.md Signed-off-by: Helen Cheng <[email protected]> * Peer review for space.md Signed-off-by: Helen Cheng <[email protected]> --------- Signed-off-by: Helen Cheng <[email protected]> * Update app.md Signed-off-by: Sandy Lai <[email protected]> * Add revised telemetry_drain.md Signed-off-by: Sandy Lai <[email protected]> * Add reviewed pipeline_promotion.md Signed-off-by: Sandy Lai <[email protected]> * Delete docs/pipeline_promotion.md Signed-off-by: Sandy Lai <[email protected]> * Create pipeline_promotion.md Signed-off-by: Sandy Lai <[email protected]> * Add Cedar-only note to app_release.md Signed-off-by: Sandy Lai <[email protected]> * Update note about classic buildpacks app_release.md Signed-off-by: Sandy Lai <[email protected]> * Add classic buildpacks-only note to slug.md Also conform to style guidelines Signed-off-by: Sandy Lai <[email protected]> * Add Cedar-only note to space_inbound_ruleset.md Signed-off-by: Sandy Lai <[email protected]> * Add Cedar-only note space_peering_connection_accepter.md And changes to conform to style guidelines Signed-off-by: Sandy Lai <[email protected]> * Update pipeline.md Signed-off-by: Sandy Lai <[email protected]> * Add classic buildpack note to app.md and changes to conform to style guidelines Signed-off-by: Sandy Lai <[email protected]> * Add Cedar-only note review_app_config.md also changes to conform to style guidelines Signed-off-by: Sandy Lai <[email protected]> * Change slug to build artifacts in pipeline_coupling.md Signed-off-by: Sandy Lai <[email protected]> * Update CIDR attributes to say only for Cedar in space.md Signed-off-by: Sandy Lai <[email protected]> * Fix formatting docs/data-sources/app.md Co-authored-by: Mars Hall <[email protected]> Signed-off-by: Sandy Lai <[email protected]> * Peer review for terraform docs (#414) * Peer review pipeline_promotion.md Signed-off-by: Helen Cheng <[email protected]> * Update telemetry_drain.md Signed-off-by: Helen Cheng <[email protected]> * Correct note format pipeline_promotion.md Signed-off-by: Sandy Lai <[email protected]> --------- Signed-off-by: Helen Cheng <[email protected]> Signed-off-by: Sandy Lai <[email protected]> Co-authored-by: Sandy Lai <[email protected]> * Fix note formatting app.md Signed-off-by: Sandy Lai <[email protected]> * Fix note formatting in build.md Signed-off-by: Sandy Lai <[email protected]> * Update space.md Signed-off-by: Sandy Lai <[email protected]> --------- Signed-off-by: Sandy Lai <[email protected]> Signed-off-by: Helen Cheng <[email protected]> Co-authored-by: Helen Cheng <[email protected]> Co-authored-by: Mars Hall <[email protected]> --------- Signed-off-by: Johnny Winn <[email protected]> Signed-off-by: Sandy Lai <[email protected]> Signed-off-by: Helen Cheng <[email protected]> Signed-off-by: Mars Hall <[email protected]> Co-authored-by: Sandy Lai <[email protected]> Co-authored-by: Mars Hall <[email protected]> Co-authored-by: Mars Hall <[email protected]> Co-authored-by: Helen Cheng <[email protected]>
1 parent 178a3be commit fcb2977

40 files changed

+2561
-311
lines changed

.github/workflows/acceptance-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Acceptance
22
on:
33
pull_request:
44
branches:
5-
- master
5+
- master
6+
- fir-compatibility
67
paths-ignore:
78
- 'docs/**'
89
- '**.md'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ website/vendor
3232
# Test exclusions
3333
!command/test-fixtures/**/*.tfstate
3434
!command/test-fixtures/**/.terraform/
35+
36+
.cursor/

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
golang 1.24.5
2+
terraform 1.5.7

docs/data-sources/app.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ description: |-
88

99
# Data Source: heroku_app
1010

11-
Use this data source to get information about a Heroku App.
11+
Use this data source to get information about a Heroku app.
12+
13+
~> **NOTE:** This resource is only supported for apps that use [classic buildpacks](https://devcenter.heroku.com/articles/buildpacks#classic-buildpacks).
1214

1315
## Example Usage
1416

@@ -23,50 +25,48 @@ data "heroku_app" "default" {
2325

2426
The following arguments are supported:
2527

26-
* `name` - (Required) The name of the application. In Heroku, this is also the
28+
* `name`: (Required) The name of the application. In Heroku, it's a
2729
unique ID, so it must be unique and have a minimum of 3 characters.
2830

2931
## Attributes Reference
3032

3133
The following attributes are exported:
3234

33-
* `id` - The unique UUID of the Heroku app.
35+
* `id`: The unique UUID of the Heroku app.
3436

35-
* `name` - The name of the application. In Heroku, this is also the
37+
* `name`: The name of the application. In Heroku, it's also the
3638
unique ID.
3739

38-
* `stack` - The application stack is what platform to run the application
39-
in.
40+
* `stack`: The application [stack](https://devcenter.heroku.com/articles/stack) is what platform to run the application in.
4041

41-
* `buildpacks` - A list of buildpacks that this app uses.
42+
* `buildpacks`: A list of buildpacks that this app uses.
4243

43-
* `space` - The private space in which the app runs. Not present if this is a common runtime app.
44+
* `space`: The [space](https://devcenter.heroku.com/articles/private-spaces) in which the app runs. Not present for [Common Runtime](https://devcenter.heroku.com/articles/dyno-runtime#common-runtime) apps.
4445

45-
* `region` - The region in which the app is deployed.
46+
* `region`: The region in the app is deployed in.
4647

47-
* `git_url` - The Git URL for the application. This is used for
48+
* `git_url`: The Git URL for the application, used for
4849
deploying new versions of the app.
4950

50-
* `web_url` - The web (HTTP) URL that the application can be accessed
51-
at by default.
51+
* `web_url`: The web (HTTP) URL to access the application at by default.
5252

53-
* `heroku_hostname` - The hostname for the Heroku application, suitable
53+
* `heroku_hostname`: The hostname for the Heroku application, suitable
5454
for pointing DNS records.
5555

56-
* `last_release_id` - The last successful Release ID for the app. May be empty.
56+
* `last_release_id`: The last successful Release ID for the app. May be empty.
5757

58-
* `last_slug_id` - The Slug ID from the last successful release. May be empty.
58+
* `last_slug_id`: The slug ID from the last successful release. May be empty.
5959

60-
* `config_vars` - A map of all configuration variables for the app.
60+
* `config_vars`: The map of all configuration variables for the app.
6161

62-
* `acm` - True if Heroku ACM is enabled for this app, false otherwise.
62+
* `acm`: True if [Heroku Automated Certificate Management](https://devcenter.heroku.com/articles/automated-certificate-management) is enabled for this app, false otherwise.
6363

64-
* `organization` - The Heroku Team that owns this app.
64+
* `organization`: The Heroku team that owns this app.
6565

66-
* `name` - The name of the Heroku Team (organization).
66+
* `name`: The name of the Heroku team (organization).
6767

68-
* `locked` - True if the app access is locked
68+
* `locked`: True if the app access is locked
6969

70-
* `personal`
70+
* `personal`: True for personal apps
7171

72-
* `uuid` - The unique UUID of the Heroku app.
72+
* `uuid`: The unique UUID of the Heroku app.

docs/resources/app.md

Lines changed: 157 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@ layout: "heroku"
33
page_title: "Heroku: heroku_app"
44
sidebar_current: "docs-heroku-resource-app-x"
55
description: |-
6-
Provides a Heroku App resource. This can be used to create and manage applications on Heroku.
6+
Provides a Heroku App resource. Use this resource to create and manage applications on Heroku.
77
---
88

99
# heroku\_app
1010

11-
Provides a Heroku App resource. This can be used to create and manage applications on Heroku.
11+
Provides a [Heroku App](https://devcenter.heroku.com/articles/platform-api-reference#app) resource. Use this resource to create and manage applications on Heroku.
1212

13-
-> **Always reference apps by ID (UUID) in Terraform configuration**
14-
Starting with v5.0 of this provider, all HCL app references are by ID. Read more details in [Upgrading](guides/upgrading.html).
13+
The Heroku platform supports two [generations](https://devcenter.heroku.com/articles/generations):
14+
- **Cedar** (default): Legacy platform with support for classic buildpacks, stack configuration, and internal routing
15+
- **Fir**: Next-generation platform with enhanced security, and modern containerization
16+
17+
-> **Note:** Always reference apps by ID (UUID) in Terraform configuration. Starting with v5.0 of this provider, all HCL app references are by ID. Read more details in [Upgrading](guides/upgrading.html).
1518

1619
## Example Usage
1720

21+
### Cedar Generation Using Classic Buildpacks (Default)
1822
```hcl-terraform
19-
resource "heroku_app" "default" {
20-
name = "my-cool-app"
23+
resource "heroku_app" "cedar_app" {
24+
name = "my-cedar-app"
2125
region = "us"
2226
2327
config_vars = {
@@ -27,12 +31,43 @@ resource "heroku_app" "default" {
2731
buildpacks = [
2832
"heroku/go"
2933
]
34+
35+
stack = "heroku-22"
36+
}
37+
```
38+
39+
### Fir Generation Using Cloud Native Buildpacks (via Fir Space)
40+
```hcl-terraform
41+
# Create a Fir-generation space first
42+
resource "heroku_space" "fir_space" {
43+
name = "my-fir-space"
44+
organization = "my-org"
45+
region = "virginia"
46+
generation = "fir"
47+
}
48+
49+
# Apps deployed to Fir spaces automatically use Fir generation
50+
resource "heroku_app" "fir_app" {
51+
name = "my-fir-app"
52+
region = "virginia"
53+
space = heroku_space.fir_space.name
54+
55+
organization {
56+
name = "my-org"
57+
}
58+
59+
config_vars = {
60+
FOOBAR = "baz"
61+
}
62+
63+
# Note: buildpacks and stack are not supported for Fir-generation apps as they use Cloud Native Buildpacks
64+
# Use project.toml in your application code instead
3065
}
3166
```
3267

3368
## Example Usage for a Team
3469

35-
A Heroku "team" was originally called an "organization", and that is still the identifier used in this resource.
70+
A Heroku "team" was originally called an "organization", and that's still the identifier used in this resource.
3671

3772
```hcl-terraform
3873
resource "heroku_app" "default" {
@@ -47,80 +82,147 @@ resource "heroku_app" "default" {
4782

4883
## Argument Reference
4984

50-
The following arguments are supported:
51-
52-
* `name` - (Required) The name of the application. In Heroku, this is also the
53-
unique ID, so it must be unique and have a minimum of 3 characters.
54-
* `region` - (Required) The region that the app should be deployed in.
55-
* `stack` - (Optional) The application stack is what platform to run the application in.
56-
* `buildpacks` - (Optional) Buildpack names or URLs for the application.
57-
Buildpacks configured externally won't be altered if this is not present.
58-
* `config_vars`<sup>[1](#deleting-vars)</sup> - (Optional) Configuration variables for the application.
59-
The config variables in this map are not the final set of configuration
60-
variables, but rather variables you want present. That is, other
61-
configuration variables set externally won't be removed by Terraform
85+
The resource supports the following arguments:
86+
87+
* `name`: (Required) The name of the application. In Heroku, this argument is the unique ID, so it must be unique and have a minimum of 3 characters.
88+
* `region`: (Required) The region to deploy the app in.
89+
* `generation`: (Computed) Generation of the app platform. Automatically determined based on the space the app is deployed to. Apps in Fir-generation spaces are `fir`, all other apps are `cedar`.
90+
- `cedar`: Legacy platform supporting classic buildpacks, stack configuration, and internal routing.
91+
- `fir`: Next-generation platform with Cloud Native Buildpacks (CNB). No support for `buildpacks`, `stack`, or `internal_routing` fields.
92+
* `stack`: (Optional) The name of the [stack](https://devcenter.heroku.com/articles/stack) to run the application in. **Note**: Not supported for `fir` generation apps.
93+
* `buildpacks`: (Optional) Classic buildpack names or URLs for the application.
94+
Buildpacks configured externally won't be altered if this isn't present. **Note**: Not supported for apps using Cloud Native Buildpacks, like Fir-generation apps. Use `project.toml` for configuration instead.
95+
* `config_vars`<sup>[1](#deleting-vars)</sup>: (Optional) Configuration variables for the application.
96+
The config variables in this map aren't the final set of configuration
97+
variables, but rather variables you want present. Terraform doesn't remove configuration variables set externally
6298
if they aren't present in this list.
63-
* `sensitive_config_vars`<sup>[1](#deleting-vars)</sup> - (Optional) This argument is the same as `config_vars`.
99+
* `sensitive_config_vars`<sup>[1](#deleting-vars)</sup>: (Optional) This argument is the same as `config_vars`.
64100
The main difference between the two is when `sensitive_config_vars` outputs
65-
are displayed on-screen following a terraform apply or terraform refresh,
66-
they are redacted, with <sensitive> displayed in place of their value.
67-
It is recommended to put private keys, passwords, etc in this argument.
68-
* `space` - (Optional) The name of a private space to create the app in.
69-
* `internal_routing` - (Optional) If true, the application will be routable
70-
only internally in a private space. This option is only available for apps
71-
that also specify `space`.
72-
* `organization` - (Optional) A block that can be specified once to define
101+
are displayed on-screen following a `terraform apply` or `terraform refresh`,
102+
they're redacted, with `<sensitive>` displayed in place of their value.
103+
It's recommended to put sensitive information like private keys, and passwords in this argument.
104+
* `space`: (Optional) The name of the space to create the app in.
105+
* `internal_routing` - (Optional) If true, the application is routable
106+
only internally in Heroku Private Spaces. This option is only available for apps
107+
that also specify `space`. **Note**: Only supported for apps in Cedar-generation spaces.
108+
* `organization`: (Optional) Specify this block once to define
73109
Heroku Team settings for this app. The fields for this block are
74110
documented below.
75-
* `acm` - (Optional) The flag representing Automated Certificate Management for the app.
111+
* `acm`: (Optional) If Automated Certificate Management is enabled for the app.
76112

77113
The `organization` block supports:
78-
* `name` (string) - The name of the Heroku Team.
79-
* `locked` (boolean) - Are other team members forbidden from joining this app.
80-
* `personal` (boolean) - Force creation of the app in the user account even if a default team is set.
114+
* `name` (string): The name of the Heroku Team.
115+
* `locked` (boolean): If other team members are forbidden from joining this app.
116+
* `personal` (boolean): Force creation of the app in the user's account, even if a default team is set.
81117

82-
### Deleting vars
118+
### Deleting Vars
83119

84120
Deleting an entire `config_vars` or `sensitive_config_vars` map from a `heroku_app`
85-
configuration will not actually remove the vars on the remote resource. To remove an existing variable,
86-
leave these attribute maps in-place and delete only its entries from the map. Once these attributes are
87-
empty, the map itself may be deleted from the configuration. Otherwise if one deletes the map with existing
88-
entries, the config vars will not be deleted from the remote resource.
121+
configuration doesn't remove the variables on the remote resource. To remove an existing variable,
122+
leave these attribute maps in-place and only delete its entries from the map. After these attributes are
123+
empty, you can delete the map itself from the configuration. Otherwise, if you delete the map with existing
124+
entries, the config vars don't get deleted from the remote resource.
89125

90-
This is especially important if you are migrating all `config_vars` to `sensitive_config_vars` or migrating
91-
config vars to `heroku_app_config_association` resource.
126+
If you're migrating all `config_vars` to `sensitive_config_vars`, or migrating
127+
config vars to `heroku_app_config_association` resource, this behavior is especially important.
92128

93129
## Attributes Reference
94130

95131
The following attributes are exported:
96132

97-
* `id` - The ID (UUID) of the app.
98-
* `name` - The name of the app.
99-
* `stack` - The application stack is what platform to run the application in.
100-
* `space` - The private space the app should run in.
101-
* `internal_routing` - Whether internal routing is enabled the private space app.
102-
* `region` - The region that the app should be deployed in.
103-
* `git_url` - The Git URL for the application. This is used for
133+
* `id`: The ID (UUID) of the app.
134+
* `name`: The name of the app.
135+
* `generation`: Generation of the app platform (`cedar` or `fir`). Automatically determined from the space the app is deployed to.
136+
* `stack`: The name of the [stack](https://devcenter.heroku.com/articles/stack) the application is run in.
137+
* `space`: The space the app is in.
138+
* `internal_routing`: If internal routing is enabled. Only for apps in Heroku Private Spaces.
139+
* `region`: The region that the app is deployed to.
140+
* `git_url`: The Git URL for the application, used for
104141
deploying new versions of the app.
105-
* `web_url` - The web (HTTP) URL that the application can be accessed
106-
at by default.
107-
* `heroku_hostname` - A hostname for the Heroku application, suitable
142+
* `web_url`: The web (HTTP) URL for accessing the application by default.
143+
* `heroku_hostname`: The hostname for the Heroku application, suitable
108144
for pointing DNS records.
109-
* `all_config_vars` - A map of all configuration variables that
145+
* `all_config_vars`: The map of all configuration variables that
110146
exist for the app, containing both those set by Terraform and those
111-
set externally. (These are treated as "sensitive" so that
112-
their values are redacted in console output.) This attribute is not set in state if the `provider`
147+
set externally. These variables are treated as "sensitive" so that
148+
their values are redacted in console output. This attribute isn't set in state if the `provider`
113149
attribute `set_app_all_config_vars_in_state` is `false`.
114-
* `uuid` - The unique UUID of the Heroku app. **NOTE:** Use this for `null_resource` triggers.
150+
* `uuid`: The unique UUID of the Heroku app. **Note:** Use this attribute for `null_resource` triggers.
151+
152+
## Cloud Native Buildpacks
153+
154+
When apps are deployed to Fir-generation spaces, they automatically use Cloud Native Buildpacks (CNB) instead of classic Heroku buildpacks. CNBs require different configuration approaches:
155+
156+
### project.toml Configuration
157+
158+
Instead of specifying `buildpacks` in Terraform, create a `project.toml` file in your application root:
159+
160+
```toml
161+
[build]
162+
[[build.buildpacks]]
163+
id = "heroku/nodejs"
164+
165+
[[build.buildpacks]]
166+
id = "heroku/procfile"
167+
168+
[build.env]
169+
BP_NODE_VERSION = "18.*"
170+
```
171+
172+
### Migration from Cedar to Fir
173+
174+
When migrating from Cedar to Fir generation:
175+
176+
1. **Create a Fir space**: Create a new space with `generation = "fir"`.
177+
2. **Remove unsupported fields**: Remove `buildpacks`, `stack`, and `internal_routing` from your Terraform configuration.
178+
3. **Add a `project.toml` file**: Create a `project.toml` file in your application code with Cloud Native Buildpacks configuration.
179+
4. **Update the `space`**: Change your app's `space` to use the Fir space.
180+
5. **Redeploy**: Deploy your application with the new configuration.
181+
182+
```hcl-terraform
183+
# Before (Cedar)
184+
resource "heroku_space" "cedar_space" {
185+
name = "my-space"
186+
organization = "my-org"
187+
region = "virginia"
188+
}
189+
190+
resource "heroku_app" "example" {
191+
name = "my-app"
192+
region = "virginia"
193+
space = heroku_space.cedar_space.name
194+
195+
buildpacks = ["heroku/nodejs"]
196+
stack = "heroku-22"
197+
}
198+
199+
# After (Fir)
200+
resource "heroku_space" "fir_space" {
201+
name = "my-space-fir"
202+
organization = "my-org"
203+
region = "virginia"
204+
generation = "fir"
205+
}
206+
207+
resource "heroku_app" "example" {
208+
name = "my-app"
209+
region = "virginia"
210+
space = heroku_space.fir_space.name
211+
212+
# buildpacks and stack removed - configured via project.toml
213+
# generation is automatically "fir" from the space
214+
}
215+
```
115216

116217
## Import
117218

118-
Apps can be imported using an existing app's `UUID` or name.
219+
Import apps with an existing app's `UUID` or name.
119220

120221
For example:
121222
```
122223
$ terraform import heroku_app.foobar MyApp
123224
$ terraform import heroku_app.foobar e74ac056-7d00-4a7e-aa80-df4bc413a825
124225
```
125226

126-
Please note: `config_vars` & `sensitive_config_vars` will not be imported due to limitations of Terraform's import process (see [issue](https://github.com/heroku/terraform-provider-heroku/issues/247#issuecomment-602013774)). All vars will appear to be added on the next plan/apply. The diff may be manually reconciled using the outputs of `heroku config` & `terraform plan`.
227+
>[!NOTE]
228+
>`config_vars` & `sensitive_config_vars` aren't imported due to limitations of Terraform's import process (see [issue](https://github.com/heroku/terraform-provider-heroku/issues/247#issuecomment-602013774)). All vars appear to be added on the next plan/apply. Manually reconcile the diff using the outputs of `heroku config` & `terraform plan`.

0 commit comments

Comments
 (0)