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

Error: Role already exists when deploying with Terraform to multiple regions #58

Open
jacobfike opened this issue Mar 30, 2022 · 3 comments

Comments

@jacobfike
Copy link

I am using the terraform module for newrelic log ingestion and it deploys fine to the first region, but when trying to deploy to a second region, I get the following error:

Error: failed creating IAM Role (newrelic-log-ingestion): EntityAlreadyExists: Role with name newrelic-log-ingestion already exists

I have tried changing the service_name to include the region, but then I get this error:

Error: unable to load "temp/newrelic-log-ingestion.zip": open temp/newrelic-log-ingestion.zip: no such file or directory

Even changing the service_name, lambda_image_name, and lambda_archive properties to match, it still complains that it cannot find the .zip file.

What needs to be done to allow multi-region deployment through terraform?

@mrickard
Copy link
Member

@jacobfike Have you tried amending the aws_iam_role to append the region?

@jacobfike
Copy link
Author

@mrickard It uses var.service_name as the name of the role, there is not a separate variable for that.

@graham-pye
Copy link

@jacobfike you can override the service_name variable so that it will be unique per region

So would look something like this:

module "newrelic_log_ingestion" {
  source             = "github.com/newrelic/aws-log-ingestion"
  nr_license_key     = "{{YOUR_LICENSE_KEY}}"
  service_name       = "newrelic-log-ingestion-${var.aws_region}"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants