hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

[Bug]: Post " https://elasticmapreduce.us-east-1.amazonaws.com/": read tcp 10.231.238.93:36954->52.94.230.137:443: read: connection reset by peer #39832

Open iamdb04 opened 1 month ago

iamdb04 commented 1 month ago

Terraform Core Version

1.3.5

AWS Provider Version

4.47.0

Affected Resource(s)

The given EMR should have been terminated gracefully. Here the EMR is getting terminated in the backend but the terraform apply is failing with the below response:

Post " https://elasticmapreduce.us-east-1.amazonaws.com/": read tcp 10.231.238.93:36954->52.94.230.137:443: read: connection reset by peer

Expected Behavior

Terraform apply should have given expected response. That all the resources have been destroyed.

Actual Behavior

The given EMR should have been terminated gracefully. Here the EMR is getting terminated in the backend but the terraform apply is failing with the below response:

Post " https://elasticmapreduce.us-east-1.amazonaws.com/": read tcp 10.231.238.93:36954->52.94.230.137:443: read: connection reset by peer

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_emr_cluster" "cluster" {
  name          = "emr-test-arn"
  release_label = "emr-4.6.0"
  applications  = ["Spark"]

  additional_info = <<EOF
{
  "instanceAwsClientConfiguration": {
    "proxyPort": 8099,
    "proxyHost": "myproxy.example.com"
  }
}
EOF

  termination_protection            = false
  keep_job_flow_alive_when_no_steps = true

  ec2_attributes {
    subnet_id                         = aws_subnet.main.id
    emr_managed_master_security_group = aws_security_group.sg.id
    emr_managed_slave_security_group  = aws_security_group.sg.id
    instance_profile                  = aws_iam_instance_profile.emr_profile.arn
  }

  master_instance_group {
    instance_type = "m4.large"
  }

  core_instance_group {
    instance_type  = "c4.large"
    instance_count = 1

    ebs_config {
      size                 = "40"
      type                 = "gp2"
      volumes_per_instance = 1
    }

    bid_price = "0.30"

    autoscaling_policy = <<EOF
{
"Constraints": {
  "MinCapacity": 1,
  "MaxCapacity": 2
},
"Rules": [
  {
    "Name": "ScaleOutMemoryPercentage",
    "Description": "Scale out if YARNMemoryAvailablePercentage is less than 15",
    "Action": {
      "SimpleScalingPolicyConfiguration": {
        "AdjustmentType": "CHANGE_IN_CAPACITY",
        "ScalingAdjustment": 1,
        "CoolDown": 300
      }
    },
    "Trigger": {
      "CloudWatchAlarmDefinition": {
        "ComparisonOperator": "LESS_THAN",
        "EvaluationPeriods": 1,
        "MetricName": "YARNMemoryAvailablePercentage",
        "Namespace": "AWS/ElasticMapReduce",
        "Period": 300,
        "Statistic": "AVERAGE",
        "Threshold": 15.0,
        "Unit": "PERCENT"
      }
    }
  }
]
}
EOF
  }

  ebs_root_volume_size = 100

  tags = {
    role = "rolename"
    env  = "env"
  }

  bootstrap_action {
    path = "s3://elasticmapreduce/bootstrap-actions/run-if"
    name = "runif"
    args = ["instance.isMaster=true", "echo running on master node"]
  }

  configurations_json = <<EOF
  [
    {
      "Classification": "hadoop-env",
      "Configurations": [
        {
          "Classification": "export",
          "Properties": {
            "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
          }
        }
      ],
      "Properties": {}
    },
    {
      "Classification": "spark-env",
      "Configurations": [
        {
          "Classification": "export",
          "Properties": {
            "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
          }
        }
      ],
      "Properties": {}
    }
  ]
EOF

  service_role = aws_iam_role.iam_emr_service_role.arn
}

Steps to Reproduce

terraform init terraform plan terraform apply terraform destroy

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

ArthOdak commented 1 month ago

Facing the same issue too.

justinretzolk commented 3 weeks ago

Hey @iamdb04 👋 Thank you for taking the time to raise this! The error that you're receiving is a fairly generic networking error, so my initial suspicion is that this wouldn't be a bug in the provider itself. To try to verify that, are you able to supply debug logs (redacted as needed) for further inspection?