Skip to content

Commit

Permalink
Merge pull request #35722 from juhala-aws/r-networkmonitor
Browse files Browse the repository at this point in the history
r/ Network Monitor Monitor and Probe
  • Loading branch information
ewbankkit committed Jun 24, 2024
2 parents 8926740 + 8ab3b0c commit 17bac54
Show file tree
Hide file tree
Showing 34 changed files with 2,545 additions and 69 deletions.
7 changes: 7 additions & 0 deletions .changelog/35722.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:new-resource
aws_networkmonitor_monitor
```

```release-note:new-resource
aws_networkmonitor_probe
```
18 changes: 18 additions & 0 deletions .ci/.semgrep-service-name0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4174,3 +4174,21 @@ rules:
patterns:
- pattern-regex: "(?i)ComputeOptimizer"
severity: WARNING
- id: configservice-in-func-name
languages:
- go
message: Do not use "ConfigService" in func name inside configservice package
paths:
include:
- internal/service/configservice
exclude:
- internal/service/configservice/list_pages_gen.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)ConfigService"
- focus-metavariable: $NAME
- pattern-not: func $NAME($T *testing.T)
severity: WARNING
47 changes: 29 additions & 18 deletions .ci/.semgrep-service-name1.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# Generated by internal/generate/servicesemgrep/main.go; DO NOT EDIT.
rules:
- id: configservice-in-func-name
languages:
- go
message: Do not use "ConfigService" in func name inside configservice package
paths:
include:
- internal/service/configservice
exclude:
- internal/service/configservice/list_pages_gen.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)ConfigService"
- focus-metavariable: $NAME
- pattern-not: func $NAME($T *testing.T)
severity: WARNING
- id: configservice-in-test-name
languages:
- go
Expand Down Expand Up @@ -4187,3 +4169,32 @@ rules:
- focus-metavariable: $NAME
- pattern-not: func $NAME($T *testing.T)
severity: WARNING
- id: iot-in-test-name
languages:
- go
message: Include "IoT" in test name
paths:
include:
- internal/service/iot/*_test.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-not-regex: "^TestAccIoT"
- pattern-regex: ^TestAcc.*
severity: WARNING
- id: iot-in-const-name
languages:
- go
message: Do not use "IoT" in const name inside iot package
paths:
include:
- internal/service/iot
patterns:
- pattern: const $NAME = ...
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)IoT"
severity: WARNING
108 changes: 61 additions & 47 deletions .ci/.semgrep-service-name2.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
# Generated by internal/generate/servicesemgrep/main.go; DO NOT EDIT.
rules:
- id: iot-in-test-name
languages:
- go
message: Include "IoT" in test name
paths:
include:
- internal/service/iot/*_test.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-not-regex: "^TestAccIoT"
- pattern-regex: ^TestAcc.*
severity: WARNING
- id: iot-in-const-name
languages:
- go
message: Do not use "IoT" in const name inside iot package
paths:
include:
- internal/service/iot
patterns:
- pattern: const $NAME = ...
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)IoT"
severity: WARNING
- id: iot-in-var-name
languages:
- go
Expand Down Expand Up @@ -2759,6 +2730,67 @@ rules:
patterns:
- pattern-regex: "(?i)NetworkManager"
severity: WARNING
- id: networkmonitor-in-func-name
languages:
- go
message: Do not use "NetworkMonitor" in func name inside networkmonitor package
paths:
include:
- internal/service/networkmonitor
exclude:
- internal/service/networkmonitor/list_pages_gen.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)NetworkMonitor"
- focus-metavariable: $NAME
- pattern-not: func $NAME($T *testing.T)
severity: WARNING
- id: networkmonitor-in-test-name
languages:
- go
message: Include "NetworkMonitor" in test name
paths:
include:
- internal/service/networkmonitor/*_test.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-not-regex: "^TestAccNetworkMonitor"
- pattern-regex: ^TestAcc.*
severity: WARNING
- id: networkmonitor-in-const-name
languages:
- go
message: Do not use "NetworkMonitor" in const name inside networkmonitor package
paths:
include:
- internal/service/networkmonitor
patterns:
- pattern: const $NAME = ...
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)NetworkMonitor"
severity: WARNING
- id: networkmonitor-in-var-name
languages:
- go
message: Do not use "NetworkMonitor" in var name inside networkmonitor package
paths:
include:
- internal/service/networkmonitor
patterns:
- pattern: var $NAME = ...
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)NetworkMonitor"
severity: WARNING
- id: oam-in-func-name
languages:
- go
Expand Down Expand Up @@ -4154,21 +4186,3 @@ rules:
patterns:
- pattern-regex: "(?i)recyclebin"
severity: WARNING
- id: redshift-in-func-name
languages:
- go
message: Do not use "Redshift" in func name inside redshift package
paths:
include:
- internal/service/redshift
exclude:
- internal/service/redshift/list_pages_gen.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)Redshift"
- focus-metavariable: $NAME
- pattern-not: func $NAME($T *testing.T)
severity: WARNING
18 changes: 18 additions & 0 deletions .ci/.semgrep-service-name3.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Generated by internal/generate/servicesemgrep/main.go; DO NOT EDIT.
rules:
- id: redshift-in-func-name
languages:
- go
message: Do not use "Redshift" in func name inside redshift package
paths:
include:
- internal/service/redshift
exclude:
- internal/service/redshift/list_pages_gen.go
patterns:
- pattern: func $NAME( ... )
- metavariable-pattern:
metavariable: $NAME
patterns:
- pattern-regex: "(?i)Redshift"
- focus-metavariable: $NAME
- pattern-not: func $NAME($T *testing.T)
severity: WARNING
- id: redshift-in-test-name
languages:
- go
Expand Down
2 changes: 2 additions & 0 deletions .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ service/networkfirewall:
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_networkfirewall_'
service/networkmanager:
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_networkmanager_'
service/networkmonitor:
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_networkmonitor_'
service/nimble:
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_nimble_'
service/oam:
Expand Down
6 changes: 6 additions & 0 deletions .github/labeler-pr-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,12 @@ service/networkmanager:
- any-glob-to-any-file:
- 'internal/service/networkmanager/**/*'
- 'website/**/networkmanager_*'
service/networkmonitor:
- any:
- changed-files:
- any-glob-to-any-file:
- 'internal/service/networkmonitor/**/*'
- 'website/**/networkmonitor_*'
service/nimble:
- any:
- changed-files:
Expand Down
1 change: 1 addition & 0 deletions .teamcity/components/generated/services_all.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ val services = mapOf(
"neptunegraph" to ServiceSpec("Neptune Analytics"),
"networkfirewall" to ServiceSpec("Network Firewall", vpcLock = true),
"networkmanager" to ServiceSpec("Network Manager", vpcLock = true),
"networkmonitor" to ServiceSpec("CloudWatch Network Monitor"),
"oam" to ServiceSpec("CloudWatch Observability Access Manager"),
"opensearch" to ServiceSpec("OpenSearch", vpcLock = true),
"opensearchserverless" to ServiceSpec("OpenSearch Serverless"),
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/mwaa v1.28.1
github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.9.1
github.com/aws/aws-sdk-go-v2/service/networkfirewall v1.39.1
github.com/aws/aws-sdk-go-v2/service/networkmonitor v1.4.1
github.com/aws/aws-sdk-go-v2/service/oam v1.12.1
github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.12.1
github.com/aws/aws-sdk-go-v2/service/organizations v1.28.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.9.1 h1:UjByGYRBlhjY4l8Lun62
github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.9.1/go.mod h1:5q3YTQennpO1/KB7rU71vW/9PjLC4PuosEi2xDEw5OY=
github.com/aws/aws-sdk-go-v2/service/networkfirewall v1.39.1 h1:f2TcduRAvOs8ltPaAnjSP64WHRmM/B5bsDSqXRYBYGs=
github.com/aws/aws-sdk-go-v2/service/networkfirewall v1.39.1/go.mod h1:23qyfghRkv9qOMRIL9KdUHiKyhARU/0FddRMtvMSVV0=
github.com/aws/aws-sdk-go-v2/service/networkmonitor v1.4.1 h1:ehZAcRu5cnQRYOA/JXs0wAcEgVsPhSXXiZwmDpEi5FI=
github.com/aws/aws-sdk-go-v2/service/networkmonitor v1.4.1/go.mod h1:AN15OEzh1YVoFSTlWZxMxVfSAqJCFpzVUgphuxJFjr8=
github.com/aws/aws-sdk-go-v2/service/oam v1.12.1 h1:LZrULRkfrmZVE8OHqwI8tKFEFxpjZl6ll7Bn2MCCVwg=
github.com/aws/aws-sdk-go-v2/service/oam v1.12.1/go.mod h1:yiUaEYA1zVxtz/EGgf8NE7rT56sLKGqQwQrWg/GhGu8=
github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.12.1 h1:BRAM7tTwHJojSOhiyUkPh2Z/hOco7OkayTf6MYFOF5w=
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 @@ -230,6 +230,7 @@ variable "service_labels" {
"neptunegraph",
"networkfirewall",
"networkmanager",
"networkmonitor",
"nimble",
"oam",
"opensearch",
Expand Down
5 changes: 5 additions & 0 deletions internal/conns/awsclient_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/provider/service_packages_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/service/ec2/exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ var (
FindInstanceByID = findInstanceByID
FindNetworkInterfacesByAttachmentInstanceOwnerIDAndDescription = findNetworkInterfacesByAttachmentInstanceOwnerIDAndDescription
FindNetworkInterfacesV2 = findNetworkInterfaces
FindSecurityGroupByDescriptionAndVPCID = findSecurityGroupByDescriptionAndVPCID
FindSecurityGroupByNameAndVPCID = findSecurityGroupByNameAndVPCID
FindSecurityGroupByNameAndVPCIDAndOwnerID = findSecurityGroupByNameAndVPCIDAndOwnerID
FindVPCByIDV2 = findVPCByID
FindVPCEndpointByID = findVPCEndpointByID
NewCustomFilterListFrameworkV2 = newCustomFilterListFrameworkV2
NewFilter = newFilter
NewFilterV2 = newFilterV2
ResourceAMI = resourceAMI
ResourceSecurityGroup = resourceSecurityGroup
ResourceTransitGateway = resourceTransitGateway
ResourceTransitGatewayConnectPeer = resourceTransitGatewayConnectPeer
VPCEndpointCreationTimeout = vpcEndpointCreationTimeout
Expand Down
15 changes: 13 additions & 2 deletions internal/service/ec2/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,19 @@ func FindSecurityGroupByID(ctx context.Context, conn *ec2.EC2, id string) (*ec2.
return output, nil
}

// FindSecurityGroupByNameAndVPCIDAndOwnerID looks up a security group by name, VPC ID and owner ID. Returns a retry.NotFoundError if not found.
func FindSecurityGroupByNameAndVPCIDAndOwnerID(ctx context.Context, conn *ec2.EC2, name, vpcID, ownerID string) (*ec2.SecurityGroup, error) {
func findSecurityGroupByDescriptionAndVPCID(ctx context.Context, conn *ec2.EC2, description, vpcID string) (*ec2.SecurityGroup, error) {
input := &ec2.DescribeSecurityGroupsInput{
Filters: newAttributeFilterList(
map[string]string{
names.AttrDescription: description,

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / providerlint

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / providerlint

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / providerlint

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / providerlint

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / providerlint

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / build-32-bit

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / validate-terraform (0.12.31)

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / validate-terraform (1.0.6)

undefined: names

Check failure on line 442 in internal/service/ec2/find.go

View workflow job for this annotation

GitHub Actions / go build

undefined: names
"vpc-id": vpcID,
},
),
}
return FindSecurityGroup(ctx, conn, input)
}

func findSecurityGroupByNameAndVPCIDAndOwnerID(ctx context.Context, conn *ec2.EC2, name, vpcID, ownerID string) (*ec2.SecurityGroup, error) {
input := &ec2.DescribeSecurityGroupsInput{
Filters: newAttributeFilterList(
map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion internal/service/ec2/service_package_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/service/ec2/vpc_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
// @Tags(identifierAttribute="id")
// @Testing(existsType="github.com/aws/aws-sdk-go/service/ec2;ec2.SecurityGroup")
// @Testing(importIgnore="revoke_rules_on_delete")
func ResourceSecurityGroup() *schema.Resource {
func resourceSecurityGroup() *schema.Resource {
//lintignore:R011
return &schema.Resource{
CreateWithoutTimeout: resourceSecurityGroupCreate,
Expand Down
13 changes: 13 additions & 0 deletions internal/service/networkmonitor/exports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package networkmonitor

// Exports for use in tests only.
var (
ResourceMonitor = newMonitorResource
ResourceProbe = newProbeResource

FindMonitorByName = findMonitorByName
FindProbeByTwoPartKey = findProbeByTwoPartKey
)
Loading

0 comments on commit 17bac54

Please sign in to comment.