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

Add OpenSearch service #23902

Merged
merged 21 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changelog/23902.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:new-data-source
aws_opensearch_domain
```

```release-note:new-resource
aws_opensearch_domain_policy
```

```release-note:new-resource
aws_opensearch_domain_saml_options
```

```release-note:new-resource
aws_opensearch_domain
```
2 changes: 2 additions & 0 deletions .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ service/networkfirewall:
- '((\*|-) ?`?|(data|resource) "?)aws_networkfirewall_'
service/networkmanager:
- '((\*|-) ?`?|(data|resource) "?)aws_networkmanager_'
service/opensearch:
- '((\*|-) ?`?|(data|resource) "?)aws_opensearch_'
service/opsworks:
- '((\*|-) ?`?|(data|resource) "?)aws_opsworks_'
service/organizations:
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler-pr-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ service/networkfirewall:
service/networkmanager:
- 'internal/service/networkmanager/**/*'
- 'website/**/networkmanager_*'
service/opensearch:
- 'internal/service/opensearch/**/*'
- 'website/**/opensearch_*'
service/opsworks:
- 'internal/service/opsworks/**/*'
- 'website/**/opsworks_*'
Expand Down
1 change: 1 addition & 0 deletions infrastructure/repository/labels-service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ variable "service_labels" {
"neptune",
"networkfirewall",
"networkmanager",
"opensearch",
"opsworks",
"opsworkscm",
"organizations",
Expand Down
3 changes: 3 additions & 0 deletions internal/conns/conns.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ import (
"github.com/aws/aws-sdk-go/service/networkfirewall"
"github.com/aws/aws-sdk-go/service/networkmanager"
"github.com/aws/aws-sdk-go/service/nimblestudio"
"github.com/aws/aws-sdk-go/service/opensearchservice"
"github.com/aws/aws-sdk-go/service/opsworks"
"github.com/aws/aws-sdk-go/service/opsworkscm"
"github.com/aws/aws-sdk-go/service/organizations"
Expand Down Expand Up @@ -519,6 +520,7 @@ type AWSClient struct {
NetworkFirewallConn *networkfirewall.NetworkFirewall
NetworkManagerConn *networkmanager.NetworkManager
NimbleStudioConn *nimblestudio.NimbleStudio
OpenSearchConn *opensearchservice.OpenSearchService
OpsWorksCMConn *opsworkscm.OpsWorksCM
OpsWorksConn *opsworks.OpsWorks
OrganizationsConn *organizations.Organizations
Expand Down Expand Up @@ -918,6 +920,7 @@ func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
NetworkFirewallConn: networkfirewall.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.NetworkFirewall])})),
NetworkManagerConn: networkmanager.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.NetworkManager])})),
NimbleStudioConn: nimblestudio.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.NimbleStudio])})),
OpenSearchConn: opensearchservice.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.OpenSearch])})),
OpsWorksCMConn: opsworkscm.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.OpsWorksCM])})),
OpsWorksConn: opsworks.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.OpsWorks])})),
OrganizationsConn: organizations.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.Organizations])})),
Expand Down
1 change: 1 addition & 0 deletions internal/generate/listpages/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ func init() {
awsServiceNames["networkfirewall"] = "NetworkFirewall"
awsServiceNames["networkmanager"] = "NetworkManager"
awsServiceNames["nimblestudio"] = "NimbleStudio"
awsServiceNames["opensearchservice"] = "OpenSearchService"
awsServiceNames["opsworks"] = "OpsWorks"
awsServiceNames["opsworkscm"] = "OpsWorksCM"
awsServiceNames["organizations"] = "Organizations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var sliceServiceNames = []string{
"imagebuilder",
"licensemanager",
"neptune",
"opensearchservice",
"rds",
"resourcegroupstaggingapi",
"route53resolver",
Expand Down
1 change: 1 addition & 0 deletions internal/generate/tags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@ func init() {
awsServiceNames["networkfirewall"] = "NetworkFirewall"
awsServiceNames["networkmanager"] = "NetworkManager"
awsServiceNames["nimblestudio"] = "NimbleStudio"
awsServiceNames["opensearchservice"] = "OpenSearchService"
awsServiceNames["opsworks"] = "OpsWorks"
awsServiceNames["opsworkscm"] = "OpsWorksCM"
awsServiceNames["organizations"] = "Organizations"
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/service/neptune"
"github.com/hashicorp/terraform-provider-aws/internal/service/networkfirewall"
"github.com/hashicorp/terraform-provider-aws/internal/service/networkmanager"
"github.com/hashicorp/terraform-provider-aws/internal/service/opensearch"
"github.com/hashicorp/terraform-provider-aws/internal/service/opsworks"
"github.com/hashicorp/terraform-provider-aws/internal/service/organizations"
"github.com/hashicorp/terraform-provider-aws/internal/service/outposts"
Expand Down Expand Up @@ -736,6 +737,8 @@ func Provider() *schema.Provider {
"aws_networkmanager_site": networkmanager.DataSourceSite(),
"aws_networkmanager_sites": networkmanager.DataSourceSites(),

"aws_opensearch_domain": opensearch.DataSourceDomain(),

"aws_organizations_delegated_administrators": organizations.DataSourceDelegatedAdministrators(),
"aws_organizations_delegated_services": organizations.DataSourceDelegatedServices(),
"aws_organizations_organization": organizations.DataSourceOrganization(),
Expand Down Expand Up @@ -1623,6 +1626,10 @@ func Provider() *schema.Provider {
"aws_networkmanager_transit_gateway_connect_peer_association": networkmanager.ResourceTransitGatewayConnectPeerAssociation(),
"aws_networkmanager_transit_gateway_registration": networkmanager.ResourceTransitGatewayRegistration(),

"aws_opensearch_domain": opensearch.ResourceDomain(),
"aws_opensearch_domain_policy": opensearch.ResourceDomainPolicy(),
"aws_opensearch_domain_saml_options": opensearch.ResourceDomainSAMLOptions(),

"aws_opsworks_application": opsworks.ResourceApplication(),
"aws_opsworks_custom_layer": opsworks.ResourceCustomLayer(),
"aws_opsworks_ecs_cluster_layer": opsworks.ResourceECSClusterLayer(),
Expand Down
1 change: 1 addition & 0 deletions internal/service/ec2/sweep.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func init() {
"aws_msk_cluster",
"aws_network_interface",
"aws_networkfirewall_firewall",
"aws_opensearch_domain",
"aws_redshift_cluster",
"aws_route53_resolver_endpoint",
"aws_sagemaker_notebook_instance",
Expand Down
4 changes: 2 additions & 2 deletions internal/service/elasticsearch/domain_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestAccElasticsearchDomainPolicy_basic(t *testing.T) {
resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "elasticsearch_version", "2.3"),
func(s *terraform.State) error {
awsClient := acctest.Provider.Meta().(*conns.AWSClient)
expectedArn, err := buildESDomainArn(name, awsClient.Partition, awsClient.AccountID, awsClient.Region)
expectedArn, err := buildDomainARN(name, awsClient.Partition, awsClient.AccountID, awsClient.Region)
if err != nil {
return err
}
Expand All @@ -72,7 +72,7 @@ func TestAccElasticsearchDomainPolicy_basic(t *testing.T) {
})
}

func buildESDomainArn(name, partition, accId, region string) (string, error) {
func buildDomainARN(name, partition, accId, region string) (string, error) {
if partition == "" {
return "", fmt.Errorf("Unable to construct ES Domain ARN because of missing AWS partition")
}
Expand Down
13 changes: 13 additions & 0 deletions internal/service/opensearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Terraform AWS Provider OpenSearch Package

This area is primarily for AWS provider contributors and maintainers. For information on _using_ Terraform and the AWS provider, see the links below.

OpenSearch is a continuation of the Elasticsearch service.


## Handy Links

* [Find out about contributing](../../../docs/contributing) to the AWS provider!
* AWS Provider Docs: [Home](https://registry.terraform.io/providers/hashicorp/aws/latest/docs)
* AWS Provider Docs: [One of the OpenSearch resources](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/opensearch_domain)
* AWS Docs: [AWS SDK for Go OpenSearch](https://docs.aws.amazon.com/sdk-for-go/api/service/opensearchservice/)
Loading