Skip to content

Provider produced inconsistent result after apply with empty ports parameter #2783

@tmorgansl

Description

@tmorgansl

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.13.3
Kubernetes provider version: v2.38.0
Kubernetes version: v1.34.1

Affected Resource(s)

kubernetes_manifest

Terraform Configuration Files

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    control-plane: controller-manager
  name: test
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      control-plane: controller-manager
  template:
    metadata:
      labels:
        control-plane: controller-manager
    spec:
      containers:
      - image: quay.io/crowdstrike/falcon-operator:1.8.0
        name: manager
        ports: []
resource "kubernetes_manifest" "test_operator" {
  manifest = yamldecode(file("./${path.module}/foo.yaml"))
}

Debug Output

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to kubernetes_manifest.test_operator, provider
│ "provider[\"registry.terraform.io/hashicorp/kubernetes\"]" produced an unexpected new value: .object.spec.template.spec.containers[0].ports: was
│ cty.ListValEmpty(cty.Object(map[string]cty.Type{"containerPort":cty.Number, "hostIP":cty.String, "hostPort":cty.Number, "name":cty.String, "protocol":cty.String})), but now
│ null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

terraform apply

Expected Behavior

Applies successfully

Actual Behavior

An error shown above

Important Factoids

Removing the line ports: [] from the example manifest applies successfully. It's also worth noting that I'm aware that I can use the deployment resource as an alternative. However, in my use case this deployment is applied in a for_each block with many different types of resources. Therefore, I need to use the kubernetes_manifest resource.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions