-
Notifications
You must be signed in to change notification settings - Fork 992
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
Status info missing from kubernetes_manifest object attribute after apply #1605
Comments
Hi, The "status" attribute is removed by the provider logic on purpose. This is becuase the value of status can change on the API side without intervention from Terraform and thus produce unactionable diffs in the following Let me know if this doesn't sufficiently clarify the issue. |
Understand this, both status and annotations frequently change after initial resource creation, especially for objects which have custom controllers (Ingress and ServiceAttachement being two examples) that create resources within a given cloud provider's system to provide X functionality.
This is where I would beg to differ. The diff would be one of a state change, it should show up as a "change made outside of Terraform" and when One should not need to have a data resource that depends on a resource you just created to get a value from the created resource. An existing example where this works as one would naturally have expected here is the If you omit a) Initial object is applied and the Ingress returned from the API looks like: apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: gce
networking.gke.io/v1beta1.FrontendConfig: traefik
creationTimestamp: "2022-02-17T18:10:09Z"
finalizers:
- networking.gke.io/ingress-finalizer-V2
generation: 1
name: traefik
namespace: traefik
resourceVersion: "612524"
uid: 85d6bb25-8ed3-4389-8fc1-2d4c97df8e2c
spec:
defaultBackend:
service:
name: traefik
port:
name: web
tls:
- secretName: traefik-tls-algerdev-ptlabs-dev
status:
loadBalancer: {} b) After some short amount of time — in this case, once the controller has created an http/s load balancer on Google Cloud — the object is updated by the controller and then looks like this: apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/backends: '{"k8s1-9fd681d1-traefik-traefik-80-01cfbd6f":"Unknown"}'
ingress.kubernetes.io/forwarding-rule: k8s2-fr-hs6u9rbo-traefik-traefik-35kfb15b
ingress.kubernetes.io/https-forwarding-rule: k8s2-fs-hs6u9rbo-traefik-traefik-35kfb15b
ingress.kubernetes.io/https-target-proxy: k8s2-ts-hs6u9rbo-traefik-traefik-35kfb15b
ingress.kubernetes.io/redirect-url-map: k8s2-rm-hs6u9rbo-traefik-traefik-35kfb15b
ingress.kubernetes.io/ssl-cert: k8s2-cr-hs6u9rbo-kwnt3rdrvy2od6sz-66091e840b26166a
ingress.kubernetes.io/static-ip: k8s2-fr-hs6u9rbo-traefik-traefik-35kfb15b
ingress.kubernetes.io/target-proxy: k8s2-tp-hs6u9rbo-traefik-traefik-35kfb15b
ingress.kubernetes.io/url-map: k8s2-um-hs6u9rbo-traefik-traefik-35kfb15b
kubernetes.io/ingress.class: gce
networking.gke.io/v1beta1.FrontendConfig: traefik
creationTimestamp: "2022-02-17T18:10:09Z"
finalizers:
- networking.gke.io/ingress-finalizer-V2
generation: 1
name: traefik
namespace: traefik
resourceVersion: "613099"
uid: 85d6bb25-8ed3-4389-8fc1-2d4c97df8e2c
spec:
defaultBackend:
service:
name: traefik
port:
name: web
tls:
- secretName: traefik-tls-algerdev-ptlabs-dev
status:
loadBalancer:
ingress:
- ip: 34.149.125.208 c) Run ...
kubernetes_ingress_v1.traefik: Refreshing state... [id=traefik/traefik]
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of Terraform since the
last "terraform apply":
# kubernetes_ingress_v1.traefik has changed
~ resource "kubernetes_ingress_v1" "traefik" {
id = "traefik/traefik"
~ status = [
~ {
~ load_balancer = [
~ {
~ ingress = [
+ {
+ hostname = ""
+ ip = "35.241.49.191"
},
]
},
]
},
]
~ metadata {
name = "traefik"
~ resource_version = "646816" -> "647519"
# (5 unchanged attributes hidden)
}
# (1 unchanged block hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.
─────────────────────────────────────────────────────────────────────────────
No changes. Your infrastructure matches the configuration.
Your configuration already matches the changes detected above. If you'd like
to update the Terraform state to match, create and apply a refresh-only plan:
terraform apply -refresh-only
Releasing state lock. This may take a few moments...
Apply complete! Resources: 0 added, 0 changed, 0 destroyed. The new value the controller added to In the case of wait_for = {
fields = {
"status.serviceAttachmentURL" = "^https:\\/\\/www.googleapis.com\\/.*\\/serviceAttachments\\/.*$"
}
} The examples in the documentation show configuration which basically does the same as # Check an ingress has an IP
"status.loadBalancer.ingress[0].ip" = "^(\\d+(\\.|$)){4}" It stands to reason that if one is to block create and update calls until a field is set or has a particular value, that the value will be available on the |
Hi, however in PR #1548, the status attribute is also deleted via |
see #1699 |
Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you! |
This really needs to be addressed, not left to be closed. |
Terraform Version, Provider Version and Kubernetes Version
Kubernetes version 1.21
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
The documentation states "the
object
attribute contains the state of the resource as returned by the Kubernetes API, including all default values."Various objects will expose valuable information in their status. In this case, I'd like to be able to have the Terraform module export the service attachment URL as an output:
The output should contain the same value that is shown here when getting the object via kubectl:
Actual Behavior
The resources is created, but there is no way to access the
serviceAttachmentURL
value in Terraform.Community Note
The text was updated successfully, but these errors were encountered: