Skip to content

Commit

Permalink
test/data_source/aws_elasticsearch_domain: Remove service role resour…
Browse files Browse the repository at this point in the history
…ce creation

Acceptance test before change:
```
--- FAIL: TestAccAWSDataElasticsearchDomain_advanced (18.37s)
    testing.go:569: Step 0 error: errors during apply:

        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.
        	status code: 400, request id: e62f1d43-d04c-11e9-ae4f-bb716bff761d

          on /opt/teamcity-agent/temp/buildTmp/tf-test399323254/main.tf line 70:
          (source code not available)
```

Acceptance test after change:
```
--- PASS: TestAccAWSDataElasticsearchDomain_advanced (18.37s)
```
  • Loading branch information
nywilken committed Sep 6, 2019
1 parent 8a3614e commit 0e19a67
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions aws/data_source_aws_elasticsearch_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ provider "aws" {
locals {
random_name = "test-es-%d"
}
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
resource "aws_elasticsearch_domain" "test" {
domain_name = "${local.random_name}"
elasticsearch_version = "1.5"
access_policies = <<POLICY
{
"Version": "2012-10-17",
Expand Down Expand Up @@ -135,9 +135,9 @@ func testAccAWSElasticsearchDomainConfigAdvancedWithDataSource(rInt int) string
provider "aws" {
region = "us-east-1"
}
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
locals {
Expand Down Expand Up @@ -200,14 +200,10 @@ resource "aws_security_group_rule" "test" {
security_group_id = "${aws_security_group.test.id}"
}
resource "aws_iam_service_linked_role" "test" {
aws_service_name = "es.amazonaws.com"
}
resource "aws_elasticsearch_domain" "test" {
domain_name = "${local.random_name}"
elasticsearch_version = "1.5"
access_policies = <<POLICY
{
"Version": "2012-10-17",
Expand Down Expand Up @@ -256,10 +252,6 @@ POLICY
tags = {
Domain = "TestDomain"
}
depends_on = [
"aws_iam_service_linked_role.test",
]
}
data "aws_elasticsearch_domain" "test" {
Expand Down

0 comments on commit 0e19a67

Please sign in to comment.