How to add multiple providers for acceptance tests?

I’m 95% complete of building a terraform provider for Cloudability.
The repo is here: https://github.com/skyscrapr/terraform-provider-cloudability

I built the provider using some terraform modules to test and my own test methods. The modules are here: https://github.com/skyscrapr/terraform-cloudability-modules

Everything works fine. I’m now trying to implement the documented acceptance testing framework and I need to add the AWS provider to my test provider list. But when i do this i start to get errors that I’m not seeing deploying the modules directly. I’ve pushed my current attempt to a branch here: https://github.com/skyscrapr/terraform-provider-cloudability/blob/broken/cloudability/resource_master_account_test.go

I need to include the AWS provider in the test as these resources require it.
I managed to get this to compile by adding the AWS provider to the test provider list here: https://github.com/skyscrapr/terraform-provider-cloudability/blob/broken/cloudability/provider_test.go#L16

But I’m getting errors executing the module. The errors are around access denied issues trying to access s3 bucket to add a policy or delete the bucket.

Is this the right way to approach this?

thanks for any help

Richard

OK I’ve figured out a few issues causing my pain.

The AWS provider resource “aws_cur_report_definition” must run against the us-east-1 region. This can be achieved by using a second aws provider with an alias. However I currently cannot get this to work in an acceptance test.

Futhermore, this resource can fail with a “ValidationException: Failed to verify customer bucket permission…”. This looks like an eventual consistency issue and this error should be retryable. I’ll raise an issue in the AWS provider channel.

Just to add more feedback for anyone else that finds this. I found some additional documentation on acceptance testing cross regions here. I think it would make sense to include this in the current acceptance testing documentation because this is important info.

Hi skyscrapr, did you ever get this working? What cloudability features / info were you able to integrate?
Looking at a project to figure out how to get rightsizing from cloudability into terraform.

All functionality is working except the acceptance tests due to poor multiple provider support.

I’ll take another look at them later today to see if there have been any improvements.

Sample modules of all available functionality are in this repo:

Raise an issue if you think there is missing functionality. I’ll take a look at adding it.

I just noticed that rightsizing is a new endpoint. I’ll take a look at adding this.

I’ve raised a new issue.