Terraform: ELB import documentation appears to be wrong

Created on 8 Feb 2017  ยท  6Comments  ยท  Source: hashicorp/terraform

At the bottom of https://www.terraform.io/docs/providers/aws/r/elb.html it states

ELBs can be imported using the name, e.g.

$ terraform import aws_elb.bar elb-production-12345

Nothing I do can cause it to successfully import.

Bruno:terraform bbronosky$ aws elbv2 describe-load-balancers
{
    "LoadBalancers": [
        {
            "VpcId": "vpc-5a59bd3f",
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:214013098185:loadbalancer/app/test-load-balancer/3e990cb03af6b0f2",
            "State": {
                "Code": "active"
            },
            "DNSName": "internal-test-load-balancer-380604717.us-west-2.elb.amazonaws.com",
            "SecurityGroups": [
                "sg-400eff25",
                "sg-547a622d",
                "sg-e6401d81",
                "sg-269f8d5f"
            ],
            "LoadBalancerName": "test-load-balancer",
            "CreatedTime": "2017-02-06T16:50:49.380Z",
            "Scheme": "internal",
            "Type": "application",
            "CanonicalHostedZoneId": "Z1H1FL5HABSF5",
            "AvailabilityZones": [
                {
                    "SubnetId": "subnet-222ad345",
                    "ZoneName": "us-west-2a"
                },
                {
                    "SubnetId": "subnet-51796c25",
                    "ZoneName": "us-west-2b"
                }
            ]
        }
    ]
}
Bruno:terraform bbronosky$ terraform import aws_elb.bar test-load-balancer
aws_elb.bar: Importing from ID "test-load-balancer"...
aws_elb.bar: Import complete!
  Imported aws_elb (ID: test-load-balancer)
aws_elb.bar: Refreshing state... (ID: test-load-balancer)
Error importing: 1 error(s) occurred:

* import aws_elb.bar (id: test-load-balancer): Terraform detected a resource with this ID doesn't
exist. Please verify the ID is correct. You cannot import non-existent
resources using Terraform import.
documentation provideaws

Most helpful comment

Hi everybody, https://www.terraform.io/docs/providers/aws/r/lb.html still says

"LBs can be imported using their ARN, e.g."

Can we fix this ? I just stumbled over that

All 6 comments

It would appear that what the aws cli/api refers to as elbv2 is covered by https://www.terraform.io/docs/providers/aws/r/alb.html in terraform.

Bruno:terraform bbronosky$ terraform import aws_alb.bar "arn:aws:elasticloadbalancing:us-west-2:214013098185:loadbalancer/app/test-load-balancer/3e990cb03af6b0f2"
aws_alb.bar: Importing from ID "arn:aws:elasticloadbalancing:us-west-2:214013098185:loadbalancer/app/test-load-balancer/3e990cb03af6b0f2"...
aws_alb.bar: Import complete!
  Imported aws_alb (ID: arn:aws:elasticloadbalancing:us-west-2:214013098185:loadbalancer/app/test-load-balancer/3e990cb03af6b0f2)
aws_alb.bar: Refreshing state... (ID: arn:aws:elasticloadbalancing:us-west-2:214013098185:loadbalancer/app/test-load-balancer/3e990cb03af6b0f2)

Import success! The resources imported are shown above. These are
now in your Terraform state. Import does not currently generate
configuration, so you must do this next. If you do not create configuration
for the above resources, then the next `terraform plan` will mark
them for destruction.

So this user error. However, I do think that the docs should make it clear that ELB is only for "Classic Load Balancer" and ALB is for "Application Load Balancer". And I think they should cross link each other.
screenshot 2017-02-08 12 56 52

I'll add a sentence noting that AWS may also call this "ELBv2" and vice versa but it seems like even AWS isn't consistent on their messaging. This feature was announced as "ALB" in the original post (and we implemented shortly after) and the classic has always been "ELB", it was only called "classic" after ALB was released so it seem strange for us to change that naming.

Hi everybody, https://www.terraform.io/docs/providers/aws/r/lb.html still says

"LBs can be imported using their ARN, e.g."

Can we fix this ? I just stumbled over that

Hi everybody, https://www.terraform.io/docs/providers/aws/r/lb.html still says

"LBs can be imported using their ARN, e.g."

Can we fix this ? I just stumbled over that

I agree

Hi @dirkcjelli and @eddideku ,

I'm sorry that there's still an issue here.

Please open a new issue in the terraform-provider-aws repository to request an update to the documentation.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franklinwise picture franklinwise  ยท  3Comments

darron picture darron  ยท  3Comments

ketzacoatl picture ketzacoatl  ยท  3Comments

ronnix picture ronnix  ยท  3Comments

shanmugakarna picture shanmugakarna  ยท  3Comments