hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.79k stars 9.14k forks source link

Non-existent custom service endpoint definitions? #20823

Closed lorengordon closed 2 years ago

lorengordon commented 3 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

❯ terraform version
Terraform v1.0.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.57.0

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

provider "aws" {
  endpoints {
    prometheusservice     = null
    codestarnotifications = null
  }
}

resource "aws_prometheus_workspace" "demo" {
  alias = "prometheus-test"
}

resource "aws_codecommit_repository" "code" {
  repository_name = "example-code-repo"
}

resource "aws_sns_topic" "notif" {
  name = "notification"
}

data "aws_iam_policy_document" "notif_access" {
  statement {
    actions = ["sns:Publish"]

    principals {
      type        = "Service"
      identifiers = ["codestar-notifications.amazonaws.com"]
    }

    resources = [aws_sns_topic.notif.arn]
  }
}

resource "aws_sns_topic_policy" "default" {
  arn    = aws_sns_topic.notif.arn
  policy = data.aws_iam_policy_document.notif_access.json
}

resource "aws_codestarnotifications_notification_rule" "commits" {
  detail_type    = "BASIC"
  event_type_ids = ["codecommit-repository-comments-on-commits"]

  name     = "example-code-repo-commits"
  resource = aws_codecommit_repository.code.arn

  target {
    address = aws_sns_topic.notif.arn
  }
}

Description of Bug

I was working on a config where every custom service endpoint is present in the provider config, using a map to lookup the FIPS endpoint, read from a file. If not present, the endpoint value is null to use the default. This works fine for every service except two: prometheusservice and codestarnotifications. For these two, I get an error that the "Argument named is not expected here."

Actual Behavior

❯ terraform plan
β•·
β”‚ Error: Unsupported argument
β”‚
β”‚   on main.tf line 3, in provider "aws":
β”‚    3:     prometheusservice     = null
β”‚
β”‚ An argument named "prometheusservice" is not expected here.
β•΅
β•·
β”‚ Error: Unsupported argument
β”‚
β”‚   on main.tf line 4, in provider "aws":
β”‚    4:     codestarnotifications = null
β”‚
β”‚ An argument named "codestarnotifications" is not expected here.
β•΅

Steps to Reproduce

  1. terraform plan
ewbankkit commented 2 years ago

These 2 need to be added to EndpointServiceNames in internal/provider/provider.go.

YakDriver commented 2 years ago

This is all moved now to internal/conns/conns.go and should be resolved soon.

github-actions[bot] commented 2 years ago

This functionality has been released in v3.64.1 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.