This repository was archived by the owner on Jul 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 3, 2023. It is now read-only.
Question: Availability Zone #147
Copy link
Copy link
Open
Description
Hi, I want to try using stack with current example from README.md :
module "stack" {
source = "github.com/segmentio/stack"
name = "nginx"
environment = "test"
key_name = "keys/bastion-ssh"
region = "ap-southeast-1"
availability_zones = ["ap-southeast-1a","ap-southeast-1b"]
}
module "nginx" {
source = "github.com/segmentio/stack/service"
name = "my-app"
image = "nginx"
port = 80
environment = "${module.stack.environment}"
cluster = "${module.stack.cluster}"
iam_role = "${module.stack.iam_role}"
security_groups = "${module.stack.internal_elb}"
subnet_ids = "${module.stack.internal_subnets}"
log_bucket = "${module.stack.log_bucket_id}"
zone_id = "${module.stack.zone_id}"
dns_name = "nginx-beacon"
}
As I want to deploy my stack in region ap-southeast-1 and availability zone in ["ap-southeast-1a","ap-southeast-1b"], but I got this messages :
Error: Error applying plan:
7 error(s) occurred:
* module.stack.module.vpc.aws_subnet.external[2]: 1 error(s) occurred:
* aws_subnet.external.2: Error creating subnet: InvalidParameterValue: Value (ap-southeast-1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-west-2a, us-west-2b, us-west-2c.
status code: 400, request id: 7e7b0653-f4cb-4aea-8533-98311f7d5311
* module.stack.module.vpc.aws_subnet.internal[1]: 1 error(s) occurred:
* aws_subnet.internal.1: Error creating subnet: InvalidParameterValue: Value (ap-southeast-1b) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-west-2a, us-west-2b, us-west-2c.
status code: 400, request id: bf0f5ba3-0674-4e90-9f8f-41795d386c3a
* module.stack.module.vpc.aws_subnet.external[1]: 1 error(s) occurred:
* aws_subnet.external.1: Error creating subnet: InvalidParameterValue: Value (ap-southeast-1b) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-west-2b, us-west-2a, us-west-2c.
status code: 400, request id: 36303a4a-2159-4b07-ab6a-d70f7f73f63e
* module.stack.module.vpc.aws_subnet.internal[2]: 1 error(s) occurred:
* aws_subnet.internal.2: Error creating subnet: InvalidParameterValue: Value (ap-southeast-1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-west-2a, us-west-2b, us-west-2c.
status code: 400, request id: a7bfbeae-dd7d-47a7-9da1-86f27abeca77
* module.stack.module.vpc.aws_subnet.internal[0]: 1 error(s) occurred:
* aws_subnet.internal.0: Error creating subnet: InvalidParameterValue: Value (ap-southeast-1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-west-2a, us-west-2b, us-west-2c.
status code: 400, request id: fd64bc6c-b5fd-4c19-ad3b-295cca79fe2b
* module.stack.module.vpc.aws_subnet.external[0]: 1 error(s) occurred:
* aws_subnet.external.0: Error creating subnet: InvalidParameterValue: Value (ap-southeast-1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-west-2a, us-west-2b, us-west-2c.
status code: 400, request id: 2f3d758e-bdbd-4e45-a94d-b8bde5db7de9
* module.stack.module.ecs_cluster.aws_launch_configuration.main: 1 error(s) occurred:
* aws_launch_configuration.main: InvalidAMIID.NotFound: The image id '[ami-d603afb5]' does not exist
status code: 400, request id: 6cab2352-f7df-48b1-98fd-f057b9de280e
I am using
➜ terraform version
Terraform v0.10.8
Ubuntu 17.10 amd64
Any suggestion that might fix my problem?
Thanks a lot!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
dendrochronology commentedon Jan 30, 2018
I'm getting similar errors, but for
us-east-2:I'm guessing that the regions and AMIs are no longer current. My
terraform planoutput is also referencing AMIs that don't show up when I query ec2 for current Amazon-owned AMIs, and won't even let me setregion = "us-east-2".I'll try to fork-and-fix and report back here.
dendrochronology commentedon Jan 30, 2018
I'm still not able to actually build a working stack cluster (current stack, Terraform v0.11.2), but I'm getting closer. A few discoveries so far:
InvalidAMIID.NotFoundIf I'm understanding correctly, this is because that image id doesn't exist in whatever region you're authenticating against. Make sure the key you provide in
key_nameexists in EC2 for the region you want (and add it to your~/.awsif you want to debug with the aws cli).It doesn't look like the Segment team have published an AMI in
us-east-2(Ohio), so I triedus-east-1, but then had other issues (see below).parameter availabilityZone is invalidThis is a bit confusing. It seems like the stack configs default to
us-west-2AZ's, regardless of the region you actually specify. I was able to fix that by specifyingavailability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"], so maybe that's been fixed (at least partially) since @JonathanSudibya opened this issue. I'll dig into the default stuff to see if that is in fact the case.Aside: does setting
regionin my stack module config actually do anything? I'm still prompted for a region when I runterraformcommands.Bonus:
aws_autoscaling_group: diffs didn't match during applyOnce I worked around the above issues, I believe I hit hashicorp/terraform-provider-aws#1630. There's a suggested workaround ("remove the
availability_zones, since they can be derived from thevpc_zone_identifier", per @andrewschleifer), but I haven't yet found where that is in the stack configs. I'm still new to Terraform syntax 😛weklund commentedon Feb 27, 2018
I've transversed your exact journey @dendrochronology - Were you able to find a working workaround?
manurag478 commentedon Nov 13, 2020
Please create environment variable in your app.py file in the following manner:-
env2={
"account":"Your Account ID",
"region":"ap-southeast-1",
}
and use this variable in the following manner:-
StackClass(app, "stack-name",env=env1)
I hope your problem should be solved, maybe its taking only default region values.