Code Monkey home page Code Monkey logo

Comments (5)

dtan4 avatar dtan4 commented on July 27, 2024

healthcheck.# is hardcoded to 1

I'll looking into it, whether hard-coding can be removed.

listeners/security groups/subnets don't include the references to the actual resources, just the .# attributes

I expect that terraform plan complements actual resources (= array elements) in tfstate, if only there is a number of resources (.#).
Actually it goes well with my environment.

@grosendorf Could you show me your Terraform version, tf and tfstate?

from terraforming.

grosendorf avatar grosendorf commented on July 27, 2024

@dtan4 using terraform v 0.6.0

Here's the output of terraforming elb --tfstate:

        "aws_elb.grid-env-chef-frontend": {
          "type": "aws_elb",
          "primary": {
            "id": "grid-env-chef-frontend",
            "attributes": {
              "availability_zones.#": "3",
              "connection_draining": "true",
              "connection_draining_timeout": "400",
              "cross_zone_load_balancing": "true",
              "dns_name": "xxx",
              "health_check.#": "1",
              "id": "grid-env-chef-frontend",
              "idle_timeout": "400",
              "instances.#": "0",
              "listener.#": "1",
              "name": "grid-env-chef-frontend",
              "security_groups.#": "1",
              "source_security_group": "frontend",
              "subnets.#": "3"
            }
          }
        },

and here is what terraform outputs for the same resource:

                "aws_elb.frontend": {
                    "type": "aws_elb",
                    "depends_on": [
                        "aws_security_group.frontend",
                        "aws_subnet.public",
                        "aws_subnet.public",
                        "aws_subnet.public"
                    ],
                    "primary": {
                        "id": "grid-env-chef-frontend",
                        "attributes": {
                            "availability_zones.#": "0",
                            "connection_draining": "true",
                            "connection_draining_timeout": "400",
                            "cross_zone_load_balancing": "true",
                            "dns_name": "xxx",
                            "health_check.#": "1",
                            "health_check.1780658007.healthy_threshold": "2",
                            "health_check.1780658007.interval": "30",
                            "health_check.1780658007.target": "TCP:443",
                            "health_check.1780658007.timeout": "3",
                            "health_check.1780658007.unhealthy_threshold": "2",
                            "id": "grid-env-chef-frontend",
                            "idle_timeout": "400",
                            "instances.#": "0",
                            "internal": "false",
                            "listener.#": "1",
                            "listener.3989618417.instance_port": "443",
                            "listener.3989618417.instance_protocol": "http",
                            "listener.3989618417.lb_port": "443",
                            "listener.3989618417.lb_protocol": "http",
                            "listener.3989618417.ssl_certificate_id": "",
                            "name": "grid-env-chef-frontend",
                            "security_groups.#": "1",
                            "security_groups.1627594382": "sg-6f9c5b08",
                            "source_security_group": "frontend",
                            "subnets.#": "3",
                            "subnets.2307263590": "subnet-b52d409e",
                            "subnets.2790316720": "subnet-4f0a7216",
                            "subnets.2844051356": "subnet-733d1b04",
                            "tags.#": "0",
                            "zone_id": "Z3DZXE0Q79N41H"
                        }
                    }
                }

and the .tf of the resource is as follows

resource "aws_elb" "frontend" {
    name = "${var.project}-frontend"
    subnets = [
        "${aws_subnet.public.0.id}",
        "${aws_subnet.public.1.id}",
        "${aws_subnet.public.2.id}"
        ]

    security_groups = ["${aws_security_group.frontend.id}"]

    cross_zone_load_balancing = true
    idle_timeout = 400
    connection_draining = true
    connection_draining_timeout = 400

    listener {
        instance_port = 443
        instance_protocol = "http"
        lb_port = 443
        lb_protocol = "http"
    }

    health_check {
        healthy_threshold = 2
        unhealthy_threshold = 2
        timeout = 3
        target = "TCP:443"
        interval = 30
    }

}

I whipped up a PR last night that should fix this, I'll open it shortly once I update the unit tests.

Edit: Opened PR #91

from terraforming.

dtan4 avatar dtan4 commented on July 27, 2024

I tried again with the latest Terraforming (b59764c) and Terraform v0.6.0, it shows the unexpected diff...
But #91 works file, I just merged 👍

I'll continue to look into hard-coading of healthcheck.# ...

from terraforming.

grosendorf avatar grosendorf commented on July 27, 2024

@dtan4 I think the hardcoding of healthcheck.# to 1 is actually okay for now, as AWS ELBs only support one healthcheck, although it might be worth changing to be future proof in case they decide to add support for multiple health checks.

from terraforming.

dtan4 avatar dtan4 commented on July 27, 2024

Actually API returns one healthcheck attribute per ELB as you say,

client.describe_load_balancers.load_balancer_descriptions[0]
=> #<struct Aws::ElasticLoadBalancing::Types::LoadBalancerDescription
 load_balancer_name="foobar",
...
 health_check=
  #<struct Aws::ElasticLoadBalancing::Types::HealthCheck
   target="HTTP:80/index.html",
   interval=30,
   timeout=5,
   unhealthy_threshold=2,
   healthy_threshold=10>,
...
 created_time=2015-07-16 07:04:49 UTC,
 scheme="internal">

so it seems to be good for now, and it cannot set the number over 2 because it is not an array.

However for the update of multiple healthcheck supports, I added a notification comment at 0044c90.

Thank you for your notice and investigation ❗

from terraforming.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.