This issue arrises from a question on the mailing list (see here). Here, it was confirmed that this is a bug, thus this issue.
The problem is that OpsWorks resources cannot be imported from anywhere other than us-east-1. The reason for this is that the OpsWorks client is hard-coded to connect to us-east-1 here. The assumption that OpsWorks is only supported in us-east-1 was true until recently. It is now incorrect.
One possible solution is to remove the restriction of the OpsWorks client to us-east-1.
Terraform v0.7.8
I have confirmed that the issue affects:
However, it's likely that this affects all OpsWorks resources.
None necessary
https://gist.github.com/blooshirt/269a2152eac887b2e66f11a787211926
Terraform should import the OpsWorks stack with the given ID.
Terraform fails with an error indicating that the stack cannot be found.
aws opsworks create-stack \
--name terraform_test \
--vpc-id <vpc_id> \
--service-role-arn <service_role_arn> \
--default-instance-profile-arn <ec2_role_instance_profile> \
--stack-region eu-west-1 \
--default-subnet-id <subnet_id> \
--configuration-manager Name=Chef,Version=12
TF_LOG=DEBUG terraform8 import aws_opsworks_stack.terraform_test <stack_id>
I've noticed that new Stacks always get created in the us-east-1 region; I suspect fixing this will fix that too.
The stack-region parameter of http://docs.aws.amazon.com/cli/latest/reference/opsworks/create-stack.html
I edited the file mentioned in blooshirt's reporting of the bug and compiled in debug mode. I was able to successfully run terraform import was_opsworks_stack for zone us-west-1.
Unfortunately when I tried to run the tests they failed, so I couldn't issue a pull request.
What I did:
this is line 285
client.opsworksconn = opsworks.New(usEast1Sess)
I changed it to
client.opsworksconn = opsworks.New(less)
So it uses the region passed in by the command line
I don't know go, so if I get ambitious I may try and fix the tests and issue a pull request.
Thanks,
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
I've noticed that new Stacks always get created in the
us-east-1region; I suspect fixing this will fix that too.The
stack-regionparameter of http://docs.aws.amazon.com/cli/latest/reference/opsworks/create-stack.html