<p>I am trying to create a Kubernetes Ingress object with the kubernetes_manifest terraform resource.  It is throwing the following error:</p>
<pre><code>│ Error: Failed to morph manifest to OAPI type
│ 
│   with module.services.module.portal.module.appmesh.kubernetes_manifest.service_ingress_object,
│   on .terraform/modules/services.portal.appmesh/kubernetes_manifest.tf line 104, in resource &quot;kubernetes_manifest&quot; &quot;service_ingress_object&quot;:
│  104: resource &quot;kubernetes_manifest&quot; &quot;service_ingress_object&quot; {
│ 
│ AttributeName(&quot;spec&quot;): [AttributeName(&quot;spec&quot;)] failed to morph object element into object element: AttributeName(&quot;spec&quot;).AttributeName(&quot;rules&quot;): [AttributeName(&quot;spec&quot;).AttributeName(&quot;rules&quot;)] failed to
│ morph object element into object element: AttributeName(&quot;spec&quot;).AttributeName(&quot;rules&quot;): [AttributeName(&quot;spec&quot;).AttributeName(&quot;rules&quot;)] unsupported morph of object value into type:
│ tftypes.List[tftypes.Object[&quot;host&quot;:tftypes.String, &quot;http&quot;:tftypes.Object[&quot;paths&quot;:tftypes.List[tftypes.Object[&quot;backend&quot;:tftypes.Object[&quot;resource&quot;:tftypes.Object[&quot;apiGroup&quot;:tftypes.String,
│ &quot;kind&quot;:tftypes.String, &quot;name&quot;:tftypes.String], &quot;serviceName&quot;:tftypes.String, &quot;servicePort&quot;:tftypes.DynamicPseudoType], &quot;path&quot;:tftypes.String, &quot;pathType&quot;:tftypes.String]]]]]
</code></pre>
<p>My code is:</p>
<pre><code>resource &quot;kubernetes_manifest&quot; &quot;service_ingress_object&quot; {
  manifest = {
    &quot;apiVersion&quot; = &quot;networking.k8s.io/v1beta1&quot;
    &quot;kind&quot;       = &quot;Ingress&quot;
    &quot;metadata&quot; = {
      &quot;name&quot;      = &quot;${var.service_name}-ingress&quot;
      &quot;namespace&quot; = &quot;${var.kubernetes_namespace}&quot;
      &quot;annotations&quot; = {
        &quot;alb.ingress.kubernetes.io/actions.ssl-redirect&quot; = &quot;{'Type': 'redirect', 'RedirectConfig': { 'Protocol': 'HTTPS', 'Port': '443', 'StatusCode': 'HTTP_301'}}&quot;
        &quot;alb.ingress.kubernetes.io/listen-ports&quot;         = &quot;[{'HTTP': 80}, {'HTTPS':443}]&quot;
        &quot;alb.ingress.kubernetes.io/certificate-arn&quot;      = &quot;${data.aws_acm_certificate.enivronment_default_issued.arn}&quot;
        &quot;alb.ingress.kubernetes.io/scheme&quot;               = &quot;internal&quot;
        &quot;alb.ingress.kubernetes.io/target-type&quot;          = &quot;instance&quot;
        &quot;kubernetes.io/ingress.class&quot;                    = &quot;alb&quot;
      }
    }
    &quot;spec&quot; = {
      &quot;rules&quot; = {
        &quot;host&quot; = &quot;${aws_route53_record.service_dns.fqdn}&quot;
        &quot;http&quot; = {
          &quot;paths&quot; = {
            &quot;backend&quot; = {
              &quot;serviceName&quot; = &quot;${var.service_name}-svc&quot;
              &quot;servicePort&quot; = &quot;${var.service_port}&quot;
            }
            &quot;path&quot; = &quot;/*&quot;
          }
        }
      }
    }
  }
}
</code></pre>
<p>I have tried adding brackets to the &quot;spec&quot; field, however when I do that, I just the following error:</p>
<pre><code>│ Error: Missing item separator
│ 
│   on .terraform/modules/services.portal.appmesh/kubernetes_manifest.tf line 121, in resource &quot;kubernetes_manifest&quot; &quot;service_ingress_object&quot;:
│  120:     &quot;spec&quot; = {[
│  121:       &quot;rules&quot; = {
│ 
│ Expected a comma to mark the beginning of the next item.
</code></pre>
<p>Once I get that error, I have tried adding commas under &quot;spec&quot;.  It just continuously throws the same error after this.</p>

sd-gallowaystorm
<p>I figured it out.  You need to add the bracket before the &quot;{&quot;.  So the code now looks like this:</p>
<pre><code>resource &quot;kubernetes_manifest&quot; &quot;service_ingress_object&quot; {
  manifest = {
    &quot;apiVersion&quot; = &quot;networking.k8s.io/v1beta1&quot;
    &quot;kind&quot;       = &quot;Ingress&quot;
    &quot;metadata&quot; = {
      &quot;name&quot;      = &quot;${var.service_name}-ingress&quot;
      &quot;namespace&quot; = &quot;${var.kubernetes_namespace}&quot;
      &quot;annotations&quot; = {
        &quot;alb.ingress.kubernetes.io/actions.ssl-redirect&quot; = &quot;{'Type': 'redirect', 'RedirectConfig': { 'Protocol': 'HTTPS', 'Port': '443', 'StatusCode': 'HTTP_301'}}&quot;
        &quot;alb.ingress.kubernetes.io/listen-ports&quot;         = &quot;[{'HTTP': 80}, {'HTTPS':443}]&quot;
        &quot;alb.ingress.kubernetes.io/certificate-arn&quot;      = &quot;${data.aws_acm_certificate.enivronment_default_issued.arn}&quot;
        &quot;alb.ingress.kubernetes.io/scheme&quot;               = &quot;internal&quot;
        &quot;alb.ingress.kubernetes.io/target-type&quot;          = &quot;instance&quot;
        &quot;kubernetes.io/ingress.class&quot;                    = &quot;alb&quot;
      }
    }
    &quot;spec&quot; = {
      &quot;rules&quot; = [{
        &quot;host&quot; = &quot;${aws_route53_record.service_dns.fqdn}&quot;
        &quot;http&quot; = {
          &quot;paths&quot; = [{
            &quot;backend&quot; = {
              &quot;serviceName&quot; = &quot;${var.service_name}-svc&quot;
              &quot;servicePort&quot; = &quot;${var.service_port}&quot;
            }
            &quot;path&quot; = &quot;/*&quot;
          }]
        }
      }]
    }
  }
}
</code></pre>
