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

[Bug]: "Provider produced inconsistent final plan" when updating launch_template used in aws_batch_compute_environment #39470

Open
LucaIcaro opened this issue Sep 24, 2024 · 4 comments
Labels
bug Addresses a defect in current functionality. service/batch Issues and PRs that pertain to the batch service.

Comments

@LucaIcaro
Copy link

LucaIcaro commented Sep 24, 2024

Terraform Core Version

1.6.6

AWS Provider Version

5.68

Affected Resource(s)

aws_batch_compute_environment, aws_launch_template

Expected Behavior

terraform apply should not return errors

Actual Behavior

terraform apply updates the LT but returns errors like this:

╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" changed the planned action from Update to
│ DeleteThenCreate.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Relevant Error/Panic Output Snippet

╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" changed the planned action from Update to
│ DeleteThenCreate.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .tags_all: was known,
│ but now unknown.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .ecs_cluster_arn: was
│ known, but now unknown.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .id: was known, but
│ now unknown.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .status_reason: was
│ known, but now unknown.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .service_role: was
│ known, but now unknown.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .status: was known,
│ but now unknown.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .tags: was
│ cty.MapValEmpty(cty.String), but now null.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .arn: was known, but
│ now unknown.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_environment_name_prefix: was known, but now unknown.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].allocation_strategy: was cty.StringVal(""), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].tags: was cty.MapValEmpty(cty.String), but now null.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].desired_vcpus: was known, but now unknown.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].bid_percentage: was cty.NumberIntVal(0), but now null.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].ec2_key_pair: was cty.StringVal(""), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].placement_group: was cty.StringVal(""), but now null.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].spot_iam_fleet_role: was cty.StringVal(""), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_batch_compute_environment.this to include new values learned so far during
│ apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for
│ .compute_resources[0].launch_template[0].launch_template_name: was cty.StringVal(""), but now null.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Terraform Configuration Files

resource "aws_batch_compute_environment" "this" {

  compute_environment_name = "test"
  type                            = "MANAGED"

  compute_resources {
    instance_role = "local.istance_role"
    min_vcpus           = 1
    max_vcpus           = 10
    instance_type       = [local.instance_list]
    image_id            =  "local.ami"

    launch_template {
      launch_template_id = aws_launch_template.this.id
      version = aws_launch_template.this.latest_version
    }

    subnets            = [local.subnet_ids]
    security_group_ids = [local.sg_ids]
    type               = "EC2"
  }

  lifecycle {
    create_before_destroy = true
  }
}

resource "aws_launch_template" "this" {
  update_default_version = true
  user_data = base64encode(local.user_data)
}

locals {

  user_data = <<-EOF
        Content-Type: multipart/mixed; boundary="//"
        MIME-Version: 1.0

        --//
        Content-Type: text/x-shellscript; charset="us-ascii"
        MIME-Version: 1.0
        Content-Transfer-Encoding: 7bit
        Content-Disposition: attachment; filename="userdata.txt"

        #!/bin/bash
        echo hello
        echo world
        --//--
        EOF
}

Steps to Reproduce

  • terraform init
  • terraform apply
  • change the userdata
  • terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@LucaIcaro LucaIcaro added the bug Addresses a defect in current functionality. label Sep 24, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/batch Issues and PRs that pertain to the batch service. service/ec2 Issues and PRs that pertain to the ec2 service. needs-triage Waiting for first response or review from a maintainer. labels Sep 24, 2024
@frosforever
Copy link
Contributor

frosforever commented Oct 16, 2024

Is this addressed by #38628? Nope as it seems like the changes in that PR are already on main

@justinretzolk justinretzolk removed service/ec2 Issues and PRs that pertain to the ec2 service. needs-triage Waiting for first response or review from a maintainer. labels Oct 30, 2024
@inez
Copy link
Contributor

inez commented Dec 11, 2024

I wonder if there is a known workaround for this issue?

@frosforever
Copy link
Contributor

@inez yell if you find one. I've taken to never updating any compute environment and instead creating new ones and swapping them into the queue. This is manual and tedious but the alternative is that TF blows away the CE when the apply gets an inconsistent plan which is very disruptive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/batch Issues and PRs that pertain to the batch service.
Projects
None yet
Development

No branches or pull requests

4 participants