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

[Bug]: Terraform prompt service linked role error if enable custom endpoint #28433

Open
Wyifei opened this issue Dec 17, 2022 · 1 comment
Open
Labels
bug Addresses a defect in current functionality. service/opensearch Issues and PRs that pertain to the opensearch service.

Comments

@Wyifei
Copy link

Wyifei commented Dec 17, 2022

Terraform Core Version

1.3.6

AWS Provider Version

4.47.0

Affected Resource(s)

aws_opensearch_domain
aws_iam_service_linked_role

Expected Behavior

The opensearch could be created without error

Actual Behavior

Terraform prompt error

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_iam_service_linked_role" "test" {
  aws_service_name = "opensearchservice.amazonaws.com"
}

resource "aws_opensearch_domain" "test" {
  depends_on = [
    aws_iam_service_linked_role.test
  ]
  domain_name    = "${var.projectname}-${var.environment}"
  engine_version = "OpenSearch_1.3"

  cluster_config {
    instance_type          = "t3.medium.search"
    instance_count         = 3
    zone_awareness_enabled = true
    zone_awareness_config {
      availability_zone_count = 3
    }
  }

  advanced_security_options {
    enabled = true
    internal_user_database_enabled = true
    master_user_options {
      master_user_name     = "admin"
      master_user_password = yamldecode(nonsensitive(aws_secretsmanager_secret_version.dashboard_credentials.secret_string)).data
    }
  }

  node_to_node_encryption {
    enabled = true
  }

  domain_endpoint_options {
    custom_endpoint_enabled         = true
    custom_endpoint                 = "logs.${var.region}.${var.testdomain}"
    custom_endpoint_certificate_arn = data.aws_acm_certificate.test_cert.arn
    enforce_https                   = true
    tls_security_policy             = "Policy-Min-TLS-1-2-2019-07"
  }


  encrypt_at_rest {
    enabled = true
  }


  ebs_options {
    ebs_enabled = true
    volume_size = 10
  }


  tags = {
    Name        = "${var.projectname}-${var.environment}"
    Environment = "${var.environment}"
  }

}

resource "aws_opensearch_domain_policy" "test" {
  domain_name = aws_opensearch_domain.test.domain_name

  access_policies = templatefile("${path.module}/policies/access_policy.json", {
    arn = data.aws_opensearch_domain.test.arn
  })
  depends_on = [aws_opensearch_domain.test]
}

resource "aws_route53_record" "test" {
  zone_id = data.aws_route53_zone.test.zone_id
  name    = "logs.${var.region}.${var.testdomain}"
  type    = "CNAME"
  ttl     = 300
  records = ["${aws_opensearch_domain.test.endpoint}"]
}

Steps to Reproduce

  1. Terraform apply then prompt error:

image

  1. If comment customer part as below, terraform apply runs normally

    domain_endpoint_options {
      #custom_endpoint_enabled         = true
      #custom_endpoint                 = "logs.${var.region}.${var.testdomain}"
      #custom_endpoint_certificate_arn = data.aws_acm_certificate.test_cert.arn
      enforce_https                   = true
      tls_security_policy             = "Policy-Min-TLS-1-2-2019-07"
    }

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@Wyifei Wyifei added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Dec 17, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/iam Issues and PRs that pertain to the iam service. service/opensearch Issues and PRs that pertain to the opensearch service. service/route53 Issues and PRs that pertain to the route53 service. labels Dec 17, 2022
@justinretzolk justinretzolk removed service/iam Issues and PRs that pertain to the iam service. service/route53 Issues and PRs that pertain to the route53 service. needs-triage Waiting for first response or review from a maintainer. labels Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/opensearch Issues and PRs that pertain to the opensearch service.
Projects
None yet
Development

No branches or pull requests

2 participants