Comments (2)
@brikis98 @adeomisor Launch configurations are no longer supported by AWS. You need to use a Launch Template. I've included an example below:
resource "aws_launch_template" "example" {
image_id = "ami-083eed19fc801d7a4"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.instance.id]
user_data = base64encode(templatefile("user-data.sh", {
server_port = var.server_port
db_address = data.terraform_remote_state.db.outputs.address
db_port = data.terraform_remote_state.db.outputs.port
}))
# Required when using a launch configuration with an auto scaling group.
lifecycle {
create_before_destroy = true
}
}
resource "aws_autoscaling_group" "example" {
launch_template {
id = aws_launch_template.example.id
}
vpc_zone_identifier = data.aws_subnets.default.ids
target_group_arns = [aws_lb_target_group.asg.arn]
health_check_type = "ELB"
min_size = 2
max_size = 10
tag {
key = "Name"
value = "${var.cluster_name}-asg"
propagate_at_launch = true
}
}
from terraform-up-and-running-code.
I am having some errors with the code from Chapter 3 when we split the code to folders. I had written the code on chapter 3 and it worked well till I got to the "Isolation via File Layout". I was using us-east-1 region. I deleted app resources from the us-east-1, including s3 buckets and other resources
Did you run terragrunt destroy
?
After splitting the code into different folders, for the webserver-cluster, I changed the region to us-east-2. I ran terraform init and it was successful.
Terraform plan also worked well. When I ran terraform apply, it failed at the launch configuration with this error.:
aws_launch_configuration: "couldn't find `resource"
I discovered that it is pulling data from my us-east-1. I changed my .aws credentials to use us-east-2 as my default region but still getting the same issue.
If you didn't run destroy
, then you still have state pointing at us-east-1. Switch your code back to us-east-1, run destroy
, then finally switch to us-east-2.
But the global/S3 runs smoothly.
I created new folders and wrote a new code there and I am now getting this error:
**Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically use this backend unless the backend configuration changes. Error refreshing state: state data in S3 does not have the expected content.
This may be caused by unusually long delays in S3 processing a previous state update. Please wait for a minute or two and try again. If this problem persists, and neither S3 nor DynamoDB are experiencing an outage, you may need to manually verify the remote state and update the Digest value stored in the DynamoDB table to the following value:**
``
S3 buckets live in a specific region too. Did you switch the region in your code to us-east-2, but not actually re-create the bucket in that region?
from terraform-up-and-running-code.
Related Issues (20)
- EC2 instance not responding on port 8080 HOT 3
- Issue with code update for EC2 HOT 3
- Terraform Up and Running, 3rd Edition, Chapter 4, Modularizing MySQL HOT 3
- Chapter 3: How to Manage Terraform State
- Ch7: K8s example doesn't start HOT 1
- failed to lock s3 state: 2 errors occurred: HOT 1
- Looking for an full example
- Chapter 3 - Isolation Via Workspaces HOT 1
- Chapter 3 HOT 3
- Chapter 3: webserver-cluster ALB unable to access HOT 1
- Chapter 3: db.t2.micro instance type is deprecated
- Why this web server cluster definition doesn't have backend configuration? HOT 2
- Ed. 2, Ch. 4 - Terraform modules. Remote state location for webserver uses key for mysql HOT 1
- Chapter 2, 3rd Edition, failed to retrieve auto scaling groups HOT 4
- Chapter 7, 3rd edition - IAM role required to create new AWS account failed to allow login acces HOT 1
- Chapter 2 - "Deploy a Single Server" needs updating now that EC2 classic is retired. HOT 3
- Chapter-3 - webserver not showing proper html format. HOT 2
- Chapter 2, 3rd Edition: one-webserver ended up with 2 running instances HOT 2
- Chapter 5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-up-and-running-code.