aws-log-ingestion
aws-log-ingestion copied to clipboard
Error: Role already exists when deploying with Terraform to multiple regions
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?
@jacobfike Have you tried amending the aws_iam_role
to append the region?
@mrickard It uses var.service_name
as the name of the role, there is not a separate variable for that.
@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}"
}