lgallard/terraform-aws-elasticsearch

Service role name AWSServiceRoleForAmazonElasticsearchService has been taken in this account

stormlcc opened this issue · 8 comments

If the service role already existed in the account, the error will occur.
Error: Error creating service-linked role with name es.amazonaws.com: InvalidInput: Service role name AWSServiceRoleForAmazonElasticsearchService has been taken in this account, please try a different suffix.

@stormlcc are you deploying several AWS ElasticSearch in the same account? I tried to include a custom prefix using the custom_prefix property as described in the resource documentation for Service Roles, but some services don't support it like AWS ElasticSearch Service :(

@lgallard yeah i already have 1 AWS Elasticsearch deployed. I want to deploy another 1 in the same account.
There are others who encountered the same problem (albeit from a different codebase) such as this:
https://github.com/cloudposse/terraform-aws-elasticsearch/issues/5
I prefer using yours because it is well defined and not too complicated for me to modify it.

Thanks!

@stormlcc I'm working in the fix!

@stormlcc version 0.3.0 has the fix.

Set the create_service_link_role variable to false for the additional AWS ElasticSearch clusters.


module "aws_es2" {

  source  = "lgallard/elasticsearch/aws"
  version = "0.3.0"
 
  domain_name              = var.es_domain_name2
  elasticsearch_version    = var.es_version
  create_service_link_role = false

...
}

@lgallard
Thank you very much! Tested it and verified that it works perfectly.

@stormlcc for reporting the issue and your feedback!

I got this too just now...
@lgallard, perhaps you can add a note about it in the readme so the solution is more prominent?