cloudposse / terraform-aws-ec2-instance

Terraform module for provisioning a general purpose EC2 host
https://cloudposse.com/accelerate
Apache License 2.0
168 stars 221 forks source link

Value for unconfigurable attribute in resource `aws_eip` causes terraform fail #172

Closed mariot8 closed 8 months ago

mariot8 commented 1 year ago

Describe the Bug

The Module plan fails when provisioning EC2 instance because of the "aws_eip" resource vpc argument.

module "ec2" {
  source = "cloudposse/ec2-instance/aws"
  version     = "1.1.0"
  ssh_key_pair                = "ec2"
  vpc_id                      = module.vpc.vpc_id
  subnet                      = module.vpc.subnet_ids[0]
}
Acquiring state lock. This may take a few moments...
Releasing state lock. This may take a few moments...
╷
│ Error: Value for unconfigurable attribute
│
│   with module.logstash.module.ec2_logstash.aws_eip.additional,
│   on .terraform/modules/logstash.ec2_logstash/eni.tf line 29, in resource "aws_eip" "additional":
│   29:   domain            = "vpc"
│
│ Can't configure a value for "domain": its value will be decided automatically based on the result of applying this configuration.
╵
╷
│ Error: Value for unconfigurable attribute
│
│   with module.logstash.module.ec2_logstash.aws_eip.default,
│   on .terraform/modules/logstash.ec2_logstash/main.tf line 175, in resource "aws_eip" "default":
│  175:   domain   = "vpc"
│
│ Can't configure a value for "domain": its value will be decided automatically based on the result of applying this configuration.

Expected Behavior

Terraform should plan an EC2 instance.

Steps to Reproduce

run terraform plan for the minimal module setup

Screenshots

No response

Environment

No response

Additional Context

No response

ericluria commented 1 year ago

Looks like this happens if you're on a version of the AWS provider < 5.0.0: https://stackoverflow.com/a/76688048/22424139