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

AWS OpsWorks resources cannot be imported from any region other than us-east-1 #9826

Closed
twalwyn opened this issue Nov 3, 2016 · 3 comments · Fixed by #12688
Closed

AWS OpsWorks resources cannot be imported from any region other than us-east-1 #9826

twalwyn opened this issue Nov 3, 2016 · 3 comments · Fixed by #12688

Comments

@twalwyn
Copy link

twalwyn commented Nov 3, 2016

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 Version

Terraform v0.7.8

Affected Resource(s)

I have confirmed that the issue affects:

  • aws_opsworks_stack
  • aws_opsworks_custom_layer

However, it's likely that this affects all OpsWorks resources.

Terraform Configuration Files

None necessary

Debug Output

https://gist.github.com/blooshirt/269a2152eac887b2e66f11a787211926

Expected Behavior

Terraform should import the OpsWorks stack with the given ID.

Actual Behavior

Terraform fails with an error indicating that the stack cannot be found.

Steps to Reproduce

  1. Create test stack on AWS in eu-west-1:
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
  1. Import stack with Terraform:
TF_LOG=DEBUG terraform8 import aws_opsworks_stack.terraform_test <stack_id>
  1. Input eu-west-1 when prompted for region.
  2. Observe failure
@steveh
Copy link
Contributor

steveh commented Nov 7, 2016

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

@chriswessells
Copy link

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,

@ghost
Copy link

ghost commented Apr 15, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants