-
Notifications
You must be signed in to change notification settings - Fork 989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Failed to update proposed state from prior state #2487
Comments
Having exactly the same issue today. No change of anything except provider version upgraded to |
Same here, looks related to f83d63a Trace is :
for this
|
Temporary workaround is using the previous provider version. (verified working)
|
Hi, would like to add on to this issue since this is referencing Kibana! I too faced the issue, kubernetes_manifest.my_kibana_dev: Modifying...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to kubernetes_manifest.my_kibana_dev, provider
│ "provider[\"registry.terraform.io/hashicorp/kubernetes\"]" produced an
│ unexpected new value: .object: wrong final value type: incorrect object
│ attributes.
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
Operation failed: failed running terraform apply (exit 1) but with a different setup (using ECK operator) TLDR;
|
I am seeing the same error when trying to update FluxCD
The error thrown is:
EDIT: happens with v2.31 as well as with v2.29.0 |
Hi guys! Ok I managed to fix this upon looking at the kubernetes docs more intensely. Pay attention to this part of the docs regarding computed fields TLDR;
UPDATE AttributeName("spec"): can't use tftypes.Object["config":tftypes.DynamicPseudoType, "count":tftypes.Number, "elasticsearchRef":tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String], "enterpriseSearchRef":tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String], "http":tftypes.Object["service":tftypes.Object["metadata":tftypes.Object["annotations":tftypes.Map[tftypes.String], "finalizers":tftypes.List[tftypes.String], "labels":tftypes.Map[tftypes.String], "name":tftypes.String, "namespace":tftypes.String], "spec":tftypes.Object["allocateLoadBalancerNodePorts":tftypes.Bool, "clusterIP":tftypes.String, "clusterIPs":tftypes.List[tftypes.String], "externalIPs":tftypes.List[tftypes.String], "externalName":tftypes.String, "externalTrafficPolicy":tftypes.String, "healthCheckNodePort":tftypes.Number, "internalTrafficPolicy":tftypes.String, "ipFamilies":tftypes.List[tftypes.String], "ipFamilyPolicy":tftypes.String, "loadBalancerClass":tftypes.String, "loadBalancerIP":tftypes.String, "loadBalancerSourceRanges":tftypes.List[tftypes.String], "ports":tftypes.List[tftypes.Object["appProtocol":tftypes.String, "name":tftypes.String, "nodePort":tftypes.Number, "port":tftypes.Number, "protocol":tftypes.String, "targetPort":tftypes.String]], "publishNotReadyAddresses":tftypes.Bool, "selector":tftypes.Map[tftypes.String], "sessionAffinity":tftypes.String, "sessionAffinityConfig":tftypes.Object["clientIP":tftypes.Object["timeoutSeconds":tftypes.Number]], "type":tftypes.String]], "tls":tftypes.Object["certificate":tftypes.Object["secretName":tftypes.String], "selfSignedCertificate":tftypes.Object["disabled":tftypes.Bool, "subjectAltNames":tftypes.List[tftypes.Object["dns":tftypes.String, "ip":tftypes.String]]]]], "image":tftypes.String, "monitoring":tftypes.Object["logs":tftypes.Object["elasticsearchRefs":tftypes.List[tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String]]], "metrics":tftypes.Object["elasticsearchRefs":tftypes.List[tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String]]]], "podTemplate":tftypes.Object["metadata":tftypes.Object["creationTimestamp":tftypes.DynamicPseudoType], "spec":tftypes.Object["automountServiceAccountToken":tftypes.Bool, "containers":tftypes.Tuple[tftypes.Object["name":tftypes.String, "resources":tftypes.Object["limits":tftypes.Object["cpu":tftypes.String, "memory":tftypes.String]]]], "nodeSelector":tftypes.Object["nodepool":tftypes.String]]], "revisionHistoryLimit":tftypes.Number, "secureSettings":tftypes.List[tftypes.Object["entries":tftypes.List[tftypes.Object["key":tftypes.String, "path":tftypes.String]], "secretName":tftypes.String]], "serviceAccountName":tftypes.String, "version":tftypes.String] as tftypes.Object["config":tftypes.DynamicPseudoType, "count":tftypes.Number, "elasticsearchRef":tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String], "enterpriseSearchRef":tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String], "http":tftypes.Object["service":tftypes.Object["metadata":tftypes.Object["annotations":tftypes.Map[tftypes.String], "finalizers":tftypes.List[tftypes.String], "labels":tftypes.Map[tftypes.String], "name":tftypes.String, "namespace":tftypes.String], "spec":tftypes.Object["allocateLoadBalancerNodePorts":tftypes.Bool, "clusterIP":tftypes.String, "clusterIPs":tftypes.List[tftypes.String], "externalIPs":tftypes.List[tftypes.String], "externalName":tftypes.String, "externalTrafficPolicy":tftypes.String, "healthCheckNodePort":tftypes.Number, "internalTrafficPolicy":tftypes.String, "ipFamilies":tftypes.List[tftypes.String], "ipFamilyPolicy":tftypes.String, "loadBalancerClass":tftypes.String, "loadBalancerIP":tftypes.String, "loadBalancerSourceRanges":tftypes.List[tftypes.String], "ports":tftypes.List[tftypes.Object["appProtocol":tftypes.String, "name":tftypes.String, "nodePort":tftypes.Number, "port":tftypes.Number, "protocol":tftypes.String, "targetPort":tftypes.String]], "publishNotReadyAddresses":tftypes.Bool, "selector":tftypes.Map[tftypes.String], "sessionAffinity":tftypes.String, "sessionAffinityConfig":tftypes.Object["clientIP":tftypes.Object["timeoutSeconds":tftypes.Number]], "type":tftypes.String]], "tls":tftypes.Object["certificate":tftypes.Object["secretName":tftypes.String], "selfSignedCertificate":tftypes.Object["disabled":tftypes.Bool, "subjectAltNames":tftypes.List[tftypes.Object["dns":tftypes.String, "ip":tftypes.String]]]]], "image":tftypes.String, "monitoring":tftypes.Object["logs":tftypes.Object["elasticsearchRefs":tftypes.List[tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String]]], "metrics":tftypes.Object["elasticsearchRefs":tftypes.List[tftypes.Object["name":tftypes.String, "namespace":tftypes.String, "secretName":tftypes.String, "serviceName":tftypes.String]]]], "podTemplate":tftypes.Object["spec":tftypes.Object["automountServiceAccountToken":tftypes.Bool, "containers":tftypes.Tuple[tftypes.Object["name":tftypes.String, "resources":tftypes.Object["limits":tftypes.Object["cpu":tftypes.String, "memory":tftypes.String]]]], "nodeSelector":tftypes.Object["nodepool":tftypes.String]]], "revisionHistoryLimit":tftypes.Number, "secureSettings":tftypes.List[tftypes.Object["entries":tftypes.List[tftypes.Object["key":tftypes.String, "path":tftypes.String]], "secretName":tftypes.String]], "serviceAccountName":tftypes.String, "version":tftypes.String] ProcessUpon looking at the docs, I first figured out that it would probably be a great idea to look into the resulting apiVersion: redacted
kind: Kibana
metadata:
annotations:
association.k8s.elastic.co/es-conf: '{redacted}'
creationTimestamp: redacted
generation: redacted
name: redacted
namespace: redacted
resourceVersion: redacted
uid: redacted
spec:
count: redacted
elasticsearchRef:
name: redacted
enterpriseSearchRef: {redacted}
http:
service:
metadata: {redacted}
spec: {redacted}
tls:
certificate: {redacted}
monitoring:
logs: {redacted}
metrics: {redacted}
podTemplate:
metadata:
creationTimestamp: redacted
spec:
automountServiceAccountToken: redacted
containers:
- name: kibana
resources:
limits:
cpu: redacted
memory: redacted
nodeSelector:
nodepool: redacted
version: redacted
status:
associationStatus: redacted
count: redacted
elasticsearchAssociationStatus: redacted
health: redacted
observedGeneration: redacted
selector: redacted
version: redacted I found the above really weird because some fields were missing in my original resource "kubernetes_manifest" "redacted" {
manifest = {
apiVersion = "redacted"
kind = "Kibana"
metadata = {
name = redacted
namespace = redacted
}
spec = {
version = redacted
count = redacted
elasticsearchRef = {
name = redacted
}
podTemplate = {
spec = {
automountServiceAccountToken = redacted
containers = [
{
name = "kibana"
resources = {
limits = {
memory = redacted
cpu = redacted
}
}
}
]
nodeSelector = {
nodepool = redacted
}
}
}
}
}
field_manager {
...
}
depends_on = [redacted]
} I thought perhaps the fields that ended up being changed were not in my resource "kubernetes_manifest" "redacted" {
manifest = {
...
}
# Added this block
computed_fields = [
"metadata.annotations",
"metadata.creationTimestamp",
"metadata.generation",
"metadata.resourceVersion",
"metadata.uid",
"spec.enterpriseSearchRef",
"spec.http",
"spec.monitoring",
"spec.podTemplate.metadata",
"status"
]
field_manager {
...
}
depends_on = [redacted]
} II thought that by adding the fields I did not mutate in my kubernetes_manifest.lome_kibana_sgp1_dev: Modifying...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to kubernetes_manifest.lome_kibana_sgp1_dev, provider
│ "provider[\"registry.terraform.io/hashicorp/kubernetes\"]" produced an
│ unexpected new value: .object: wrong final value type: incorrect object
│ attributes.
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
Operation failed: failed running terraform apply (exit 1) Which got me thinking that perhaps, there were some fields in the resource "kubernetes_manifest" "redacted" {
manifest = {
...
}
# Changed this block
computed_fields = [
"metadata",
"spec",
"status"
]
field_manager {
...
}
depends_on = [redacted]
} Which did the trick for me. Final Thoughts
|
I have the same issue as described above, neither field_manager to terraform, nor putting everything in computed_fields works for me. Version 2.29.0 has the same issue. I always endup with :
My terraform file :
I only have the issue with wait section, but I think this is because it first think it is deployed and resolves before encountering the error. Here are the full trace logs : https://gist.github.com/685f48c73cd814eb7fe5375fe85ca48e.git |
Just encountered this issue on v2.34.0. |
Just encountered this issue on v2.35.0 |
Same issue encountered on v2.35.1 with elasticsearch + kibana. |
I were using 2.29.0 version and after updating it to 2.30.0 version I got this kind of error, without changing anything, only provider version
Error: Failed to update proposed state from prior state
with kubernetes_manifest.kibana,
on main.tf line 87, in resource "kubernetes_manifest" "kibana":
87: resource "kubernetes_manifest" "kibana" {
AttributeName("podTemplate"): can't use
tftypes.Object["metadata":tftypes.Object["creationTimestamp":tftypes.DynamicPseudoType],
"spec":tftypes.Object["containers":tftypes.Tuple[tftypes.Object["env":tftypes.Tuple[tftypes.Object["name":tftypes.String,
"value":tftypes.String]], "name":tftypes.String,
"readinessProbe":tftypes.Object["httpGet":tftypes.Object["path":tftypes.String,
"port":tftypes.Number, "scheme":tftypes.String]],
The text was updated successfully, but these errors were encountered: