Skip to content
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

Updating internal annotation fails. #2

Closed
Phylu opened this issue Feb 28, 2018 · 6 comments
Closed

Updating internal annotation fails. #2

Phylu opened this issue Feb 28, 2018 · 6 comments

Comments

@Phylu
Copy link

Phylu commented Feb 28, 2018

Hi there,

Updating an internal annotation fails.

Terraform Version

  • Terraform v0.11.3
  • provider.kubernetes (unversioned) commit: 32a278b

Affected Resource(s)

  • kubernetes_service

Terraform Configuration Files

resource "kubernetes_service" "svc" {
  metadata {
    name = "svc"
    namespace = "namespace"
    labels {
        app = "svc"
    }
    annotations {
        "service.beta.kubernetes.io/aws-load-balancer-internal" = "0.0.0.0/0"
    }
  }
  spec {
    type = "LoadBalancer"
    port {
        port = 80
        target_port = 80
        name = "http"
    }
  }
}

Expected Behavior

Re-running terraform apply after adding the internal annotation should add the annotation to the kubernetes service

  ~ kubernetes_service.svc
      metadata.0.annotations.%:                                                     "0" => "1"
      metadata.0.annotations.service.beta.kubernetes.io/aws-load-balancer-internal: "" => "0.0.0.0/0"

Actual Behavior

The command fails with the error message:

* kubernetes_service.svc: 1 error(s) occurred:
* kubernetes_service.svc: Failed to update service: jsonpatch add operation does not apply: doc is missing path: /metadata/annotations/service.beta.kubernetes.io~1aws-load-balancer-internal

Steps to Reproduce

  1. terraform apply

References

I thought this should not be a problem due to the PR:

@sl1pm4t
Copy link
Owner

sl1pm4t commented Mar 1, 2018

Thanks @Phylu - I agree, likely the same problem as the issue you reference.
I also hit this myself this week and have been meaning to investigate.

@Phylu
Copy link
Author

Phylu commented Mar 2, 2018

I think this comment hashicorp#37 (comment) explains the issue even better that I did and even makes a suggestion on how to fix it.

@acobaugh
Copy link

acobaugh commented Mar 2, 2018

I think upstream just fixed this via hashicorp#116

@Phylu
Copy link
Author

Phylu commented Mar 5, 2018

I just cherry-picked the commits from the upstream repository and can confirm that I don't get anymore errors on update. @sl1pm4t Do you want to sync from upstream? Or shall I create a PR containing the change.

@sl1pm4t
Copy link
Owner

sl1pm4t commented Mar 5, 2018

Thanks for testing it @Phylu.
I've just rebased the custom branch on upstream master, and pushed to this repo, so it should include the fix now.

@Phylu
Copy link
Author

Phylu commented Mar 5, 2018

I can confirm that it works. Thanks a lot!

@Phylu Phylu closed this as completed Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants