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

Elastic Beanstalk Environment Tag "Name" should not be editable #3963

Closed
ghost opened this issue Mar 28, 2018 · 11 comments
Closed

Elastic Beanstalk Environment Tag "Name" should not be editable #3963

ghost opened this issue Mar 28, 2018 · 11 comments
Labels
bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@ghost
Copy link

ghost commented Mar 28, 2018

This issue was originally opened by @DemonR as hashicorp/terraform#17712. It was migrated here as a result of the provider split. The original body of the issue is below.


According to Elastic Beanstalk documentation, "Name" is one of the default tags and can't be edited. However if the "Name" tag is set in the terraform script, it will still try to apply the change.

Terraform Version

$ terraform -v
Terraform v0.11.5

Terraform Configuration Files

resource "aws_elastic_beanstalk_environment" "xxxxxxx_env" {
  name                = "${var.service_name}-${var.environment}"
  application         = "${aws_elastic_beanstalk_application.xxxxxxx.name}"
  solution_stack_name = "64bit Amazon Linux 2017.09 v2.6.4 running Python 3.6"
  tier                = "Worker"
  tags {
    Environment = "${var.environment}"
    Name        = "New Tag Name"
  }
}

Scenarios:

1. if "Name" tag is present, and there isn't any other change to the Elastic Beanstalk

Expected Behavior

"Name" tag is not applied, or report an error

Actual Behavior

Elastic Beanstalk:

2018-03-27 16:38:00 UTC-0700 | ERROR | Environment tag update failed.
-- | -- | --
2018-03-27 16:37:59 UTC-0700 | ERROR | Service:AmazonCloudFormation, Message:No updates are to be performed.
2018-03-27 16:37:59 UTC-0700 | INFO | Starting environment tag update.

Terraform:


1 error(s) occurred:

* module.xxxxxxx.aws_elastic_beanstalk_environment.xxxxxxx_env: 1 error(s) occurred:

* aws_elastic_beanstalk_environment.xxxxxxx_env: Error waiting for Elastic Beanstalk Environment (e-xxxxx) to become ready: 2 error(s) occurred:

* 2018-03-27 23:37:59.698 +0000 UTC (e-xxxxx) : Service:AmazonCloudFormation, Message:No updates are to be performed.
* 2018-03-27 23:38:00.297 +0000 UTC (e-xxxxx) : Environment tag update failed.

2. if "Name" tag is present, and there is other change to the Elastic Beanstalk environment

(in this case changing health monitoring from basic to enhanced)

Expected Behavior

"Name" tag is not applied, or report an error

Actual Behavior

Elastic Beanstalk throws the same error as before:

2018-03-28 10:19:35 UTC-0700 | ERROR | Environment tag update failed.
-- | -- | --
2018-03-28 10:19:34 UTC-0700 | ERROR | Service:AmazonCloudFormation, Message:No updates are to be performed.
2018-03-28 10:19:34 UTC-0700 | INFO | Starting environment tag update.

But terraform reports the tag is updated:

tags.Name: "" => "New Tag Name"

Steps to Reproduce

  1. terraform init
  2. terraform apply
@line0
Copy link

line0 commented Mar 29, 2018

There's also a second (arguably more disturbing) aspect to this bug: if your tag contains the string "Name" at all, it appears in a plan but it is then filtered out. If the environment already exists, apply fails as described above. However, if it's a fresh environment, the tag is just silently not created at all.

@bflad bflad added bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. labels Mar 29, 2018
@brianhealeyRMN
Copy link

I am seeing Case #2 with our projects. This appears to have started with version 1.11. Specifying 1.10 allows me to apply changes without the failure.

@mohneeshdamade
Copy link

Yes even i am seeing this issue with version 1.11 , giving the same Name tag is also failing with the same error...
What could be the workaround by the time this gets fixed?

@ryanzlu
Copy link

ryanzlu commented Apr 12, 2018

You can just remove the name tag from your terraform script, since AWS will auto generate/manage the name tag

@szpuni
Copy link

szpuni commented Oct 8, 2018

I have similar issue where I do not have Tag 'Name' in my code.
Tag name is being taken from ElasticBeanstalk 'Name' property and for some reason each time when you run apply terraform thinks it's new value and it's trying to update tags.
Issue is much more than that due to fact that till today I didn't see ticket resolved for Elastic Beanstalk being able to update tags (even tho there is a possibility now to do it using either console or AWS Cli Beanstalk Tags Issue
In my case environment name is created out of 2 tags which I insert as terraform -var argument.
Even tho name is exactly same as one with one which exist already Terraform is trying to update tag (i cannot do it cause it doesn't have that functionality) which is a quite annoying bug cause it makes terraform code for elastic beanstalk unstable (crashes each time you want to do update on existing environment or just rerun it with no changes)

@Chukobyte
Copy link

I've been running into a similar issue as @line0, our tag contains the String Name and the same errors are returned from elastic beanstalk and terraform. Is there any progress on a fix for this?

DTTerastar pushed a commit to DTTerastar/terraform-aws-eks that referenced this issue May 3, 2019
@jamie-wearsafe
Copy link

Here is how I strip out items from lists @Chukobyte

For example: If you have a Tag Map for Elastic Beanstalk and it includes Name as one of the keys.
You can strip it out.

## bs_label is from using the labeling module from cloud posse that handles tagging and resource naming.
module "bs_label" {
  source     = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.11.1"
  attributes = ["${distinct(compact(concat(var.attributes, list("beanstalk", var.application_name))))}"]
  context    = "${module.label.context}"
  enabled    = "${var.enabled}"
}

## Beanstalk Applications can't have a Name tag in their tags list. 
locals {
  keys       = "${keys(module.bs_label.tags)}"
  name_index = "${index(local.keys, "Name")}"

  keys_before   = "${slice(local.keys, 0, local.name_index)}"
  keys_after    = "${slice(local.keys, local.name_index + 1, length(local.keys))}"
  values        = "${values(module.bs_label.tags)}"
  values_before = "${slice(local.values, 0, local.name_index)}"
  values_after  = "${slice(local.values, local.name_index + 1, length(local.values))}"

  tags = "${zipmap(concat(local.keys_before, local.keys_after), concat(local.values_before, local.values_after))}"
}

@superkarn
Copy link

superkarn commented Aug 13, 2019

I ran into a similar issue as @line0 and @Chukobyte: I have a tag MyName and got the error Environment tag update failed. I changed it to MyXXX and/or my-name and everything ran fine.

For now, I'm removing Name from all my tag names. However name seems to be fine.

@aknysh
Copy link

aknysh commented Oct 4, 2019

this is how we remove the Name tag from tags using TF 0.12
https://github.com/cloudposse/terraform-aws-elastic-beanstalk-application/blob/master/main.tf#L15

(could be updated to rename the tag instead of removing if needed)

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Oct 20, 2021
@github-actions github-actions bot closed this as completed Jan 8, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

10 participants