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

Terraform plan failing for creating S3 elb log and CreateApplicationInput.ApplicationName #227

Closed
bazylhorsey opened this issue Feb 26, 2023 · 1 comment · Fixed by #243
Labels
bug 🐛 An issue with the system

Comments

@bazylhorsey
Copy link

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

After following documentation I have multiple errors coming directly from cloudposse that I can't see any way to fix as a consumer.

Expected Behavior

elastic beanstalk env should apply given all variables required.

Steps to Reproduce

module "elastic_beanstalk_application" {
  source  = "cloudposse/elastic-beanstalk-application/aws"
  version = "0.11.1"

  description = "Test Elastic Beanstalk application"

  context = module.this.context
}

module "elastic_beanstalk_environment" {
  source = "cloudposse/elastic-beanstalk-environment/aws"
  version = "0.47.2"

  
  elastic_beanstalk_application_name = module.elastic_beanstalk_application.elastic_beanstalk_application_name
  environment_type                   = "LoadBalanced"
  loadbalancer_type                  = "application"
  region                             = var.aws_region
  autoscale_min                      = 1
  //force_destroy = var.force_destroy

  instance_type    = var.instance_type
#   root_volume_size = var.root_volume_size
#   root_volume_type = var.root_volume_type

  vpc_id               = module.vpc.vpc_id
  loadbalancer_subnets = module.subnets.public_subnet_ids
  application_subnets  = module.subnets.private_subnet_ids

  allow_all_egress = true

  additional_security_group_rules = [
    {
      type                     = "ingress"
      from_port                = 0
      to_port                  = 65535
      protocol                 = "-1"
      source_security_group_id = module.vpc.vpc_default_security_group_id
      description              = "Allow all inbound traffic from trusted Security Groups"
    }
  ]

  # https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html
  # https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.docker
  solution_stack_name = "64bit Amazon Linux 2 v3.5.3 running Docker"

  env_vars = {
   for obj in concat(local.fastapi, local.database, local.traefik, local.redis, local.minio, local.external_apis) : "${obj.name}" => "${obj.value}"
  }

  extended_ec2_policy_document = data.aws_iam_policy_document.minimal_s3_permissions.json
  prefer_legacy_ssm_policy     = false
  prefer_legacy_service_policy = false

  context = module.this.context
}

data "aws_iam_policy_document" "minimal_s3_permissions" {
  statement {
    sid = "AllowS3OperationsOnElasticBeanstalkBuckets"
    actions = [
      "s3:ListAllMyBuckets",
      "s3:GetBucketLocation"
    ]
    resources = ["*"]
  }
}

Screenshots

module.elastic_beanstalk_environment.aws_s3_bucket.elb_logs[0]: Creating...
╷
│ Warning: Argument is deprecated
│ 
│   with module.elastic_beanstalk_environment.aws_s3_bucket.elb_logs[0],
│   on .terraform/modules/elastic_beanstalk_environment/main.tf line 1120, in resource "aws_s3_bucket" "elb_logs":
│ 1120: resource "aws_s3_bucket" "elb_logs" {
│ 
│ Use the aws_s3_bucket_versioning resource instead
│ 
│ (and 3 more similar warnings elsewhere)
╵
╷
│ Error: InvalidParameter: 1 validation error(s) found.
│ - minimum field size of 1, CreateApplicationInput.ApplicationName.
│ 
│ 
│   with module.elastic_beanstalk_application.aws_elastic_beanstalk_application.default,
│   on .terraform/modules/elastic_beanstalk_application/main.tf line 9, in resource "aws_elastic_beanstalk_application" "default":
│    9: resource "aws_elastic_beanstalk_application" "default" {
│ 
╵
╷
│ Error: error creating S3 Bucket (-eb-loadbalancer-logs): InvalidBucketName: The specified bucket is not valid.
│       status code: 400, request id: TA6RDH9C0H10WQE2, host id: 7RNNXz6/dKH8jYjXV/Cywf2bUWo9jEAtb+FPwm9MjleczcsyfkSOmgPJPOXgtdegc4l5U1v5HRM=
│ 
│   with module.elastic_beanstalk_environment.aws_s3_bucket.elb_logs[0],
│   on .terraform/modules/elastic_beanstalk_environment/main.tf line 1120, in resource "aws_s3_bucket" "elb_logs":
│ 1120: resource "aws_s3_bucket" "elb_logs" {

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: Linux
  • Version Fedora 35
@bazylhorsey bazylhorsey added the bug 🐛 An issue with the system label Feb 26, 2023
@bazylhorsey
Copy link
Author

#226 can confirm this seems related to mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
1 participant