How to fix planned value for a non-computed attribute in Terraform
This Terraform provider error indicates that a resource attribute was modified by the provider during planning without being marked as 'Computed' in the schema. The issue is a provider bug where attributes are set to non-null values without the proper schema configuration. This typically affects attributes with Optional: true and Default set, and is resolved by updating the provider or reporting the issue to the provider maintainers.
Quick fix
Fixes planned value for a non-computed attribute
terraform version- Check your provider version
- Upgrade the provider to the latest version
- Identify the affected resource
- Check if you can omit the problematic attribute
terraform versionplanned value for a non-computed attribute
What this error means
Terraform enforces data consistency rules: providers should only change attribute values if the schema marks them as 'Computed: true'. When a provider sets or changes an attribute value without this flag, Terraform detects the inconsistency and raises this warning. This indicates a bug in the provider's schema definition or resource implementation. The provider is attempting to manage an attribute that it shouldn't, or it's not properly declaring which attributes it will modify.
Typical symptoms
- Warning log message: 'planned value cty.False/cty.True for a non-computed attribute'
- Provider warning during terraform plan or apply operations
- Message includes the specific attribute name and planned value
- Issue appears with specific resource types that have optional attributes with defaults
- Terraform allows the operation to proceed but logs a data consistency warning
Common causes
- Provider schema defines attribute as 'Optional: true' with 'Default' set, but missing 'Computed: true'
- Provider code sets attribute value during planning that differs from configuration
- Resource implementation modifies optional attributes without proper schema declaration
- Using legacy terraform-plugin-sdk which has looser data consistency enforcement than newer plugin framework
- Provider version has incomplete schema migration from older SDK to newer framework
How to fix "planned value for a non-computed attribute"
First, identify which version of the provider you're using. Run:
terraform versionLook for the provider version in the output. This error is often fixed in newer provider versions. Check the provider's changelog to see if this issue has been addressed.
Update your versions.tf or main.tf to use a newer provider version:
terraform {
required_providers {
provider_name = {
source = "provider/name"
version = ">= X.Y.Z" # Use latest stable version
}
}
}Then run:
terraform init -upgrade
terraform planMost provider maintainers have resolved these schema inconsistencies in recent releases.
From the error message, identify which resource and attribute is causing the issue. The warning will show:
- .ATTRIBUTE_NAME: planned value cty.VALUE for a non-computed attributeNote the attribute name so you can decide if it's critical or if you can work around it.
If the problematic attribute is optional and you're not explicitly setting it, try removing it from your configuration:
resource "provider_resource" "example" {
# Remove the problematic_attribute if not needed
other_attribute = "value"
}If the attribute isn't required and you're letting it default, removing it may eliminate the warning.
If you must use the attribute, explicitly set it in your configuration to match what the provider defaults to:
resource "provider_resource" "example" {
problematic_attribute = false # Or true, depending on the default
}This ensures the configuration matches what the provider will set in state, eliminating the inconsistency.
If upgrading doesn't fix the issue, report it to the provider's issue tracker with:
- Provider name and version
- Terraform version
- The exact error message including the attribute name
- Minimal configuration that reproduces the issue
- OS and architecture
For HashiCorp providers, use: https://github.com/hashicorp/terraform-provider-NAME/issues
For community providers, check their repository for issue guidelines.
Subscribe to the provider's release notes and watch for fixes to data consistency errors. Many providers are actively migrating from terraform-plugin-sdk (SDKv2) to terraform-plugin-framework, which has stricter data consistency enforcement and fewer of these issues.
Check the provider's roadmap or migration plan to see when this update is expected.
Advanced notes
Provider SDK Migration: This error is more common in providers still using terraform-plugin-sdk (SDKv2). The legacy SDK has a special flag that demotes data consistency errors to warnings instead of hard errors. Providers migrating to terraform-plugin-framework will enforce these rules strictly.
Why It's A Warning: Terraform tolerates this behavior for SDKv2 providers as a pragmatic choice since many providers were written before Terraform 0.12's strict data consistency rules. The warning allows workflows to continue but indicates a provider bug that should be fixed.
When It Becomes Critical: If a future Terraform version or provider framework version stops tolerating this behavior, affected workflows will break. Upgrading your provider proactively prevents future breakage.
Alternative: Enable Legacy Type System Errors: Provider developers can enable EnableLegacyTypeSystemApplyErrors and EnableLegacyTypeSystemPlanErrors fields to convert these warnings to hard errors during development. This helps catch inconsistencies earlier but requires thorough testing before production release.
Frequently asked questions
- What does "planned value for a non-computed attribute" mean?
- Terraform enforces data consistency rules: providers should only change attribute values if the schema marks them as 'Computed: true'. When a provider sets or changes an attribute value without this flag, Terraform detects the inconsistency and raises this warning. This indicates a bug in the provider's schema definition or resource implementation.
- How do I fix "planned value for a non-computed attribute"?
- This Terraform provider error indicates that a resource attribute was modified by the provider during planning without being marked as 'Computed' in the schema. The issue is a provider bug where attributes are set to non-null values without the proper schema configuration. This typically affects attributes with Optional: true and Default set, and is resolved by updating the provider or reporting the issue to the provider maintainers.
- What causes "planned value for a non-computed attribute"?
- Provider schema defines attribute as 'Optional: true' with 'Default' set, but missing 'Computed: true' Provider code sets attribute value during planning that differs from configuration Resource implementation modifies optional attributes without proper schema declaration
- Is the "planned value for a non-computed attribute" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Terraform Official Documentation
- ๐