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

Implement AWS App Runner resources #19432

Merged
merged 15 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all 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/19432.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:new-resource
aws_apprunner_auto_scaling_configuration_version
```

```release-note:new-resource
aws_apprunner_connection
```

```release-note:new-resource
aws_apprunner_custom_domain_association
```

```release-note:new-resource
aws_apprunner_service
```
8 changes: 8 additions & 0 deletions .hashibot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ behavior "regexp_issue_labeler_v2" "service_labels" {
"service/appmesh" = [
"aws_appmesh_",
],
"service/apprunner" = [
"aws_apprunner_",
],
"service/appstream" = [
"aws_appstream_",
],
Expand Down Expand Up @@ -741,6 +744,11 @@ behavior "pull_request_path_labeler" "service_labels" {
"**/*_appmesh_*",
"**/appmesh_*"
]
"service/apprunner" = [
"aws/internal/service/apprunner/**/*",
"**/*_apprunner_*",
"**/apprunner_*"
]
"service/appstream" = [
"aws/internal/service/appstream/**/*",
"**/*_appstream_*",
Expand Down
3 changes: 3 additions & 0 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/aws/aws-sdk-go/service/applicationautoscaling"
"github.com/aws/aws-sdk-go/service/applicationinsights"
"github.com/aws/aws-sdk-go/service/appmesh"
"github.com/aws/aws-sdk-go/service/apprunner"
"github.com/aws/aws-sdk-go/service/appstream"
"github.com/aws/aws-sdk-go/service/appsync"
"github.com/aws/aws-sdk-go/service/athena"
Expand Down Expand Up @@ -221,6 +222,7 @@ type AWSClient struct {
appconfigconn *appconfig.AppConfig
applicationinsightsconn *applicationinsights.ApplicationInsights
appmeshconn *appmesh.AppMesh
apprunnerconn *apprunner.AppRunner
appstreamconn *appstream.AppStream
appsyncconn *appsync.AppSync
athenaconn *athena.Athena
Expand Down Expand Up @@ -468,6 +470,7 @@ func (c *Config) Client() (interface{}, error) {
appconfigconn: appconfig.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appconfig"])})),
applicationinsightsconn: applicationinsights.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["applicationinsights"])})),
appmeshconn: appmesh.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appmesh"])})),
apprunnerconn: apprunner.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["apprunner"])})),
appstreamconn: appstream.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appstream"])})),
appsyncconn: appsync.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appsync"])})),
athenaconn: athena.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["athena"])})),
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/listtags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var serviceNames = []string{
"amplify",
"apigatewayv2",
"appmesh",
"apprunner",
"appstream",
"appsync",
"athena",
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/servicetags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var sliceServiceNames = []string{
"acm",
"acmpca",
"appmesh",
"apprunner",
"athena",
"autoscaling",
"cloud9",
Expand Down
1 change: 1 addition & 0 deletions aws/internal/keyvaluetags/generators/updatetags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var serviceNames = []string{
"apigateway",
"apigatewayv2",
"appmesh",
"apprunner",
"appstream",
"appsync",
"athena",
Expand Down
18 changes: 18 additions & 0 deletions aws/internal/keyvaluetags/list_tags_gen.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/aws/aws-sdk-go/service/apigateway"
"github.com/aws/aws-sdk-go/service/apigatewayv2"
"github.com/aws/aws-sdk-go/service/appmesh"
"github.com/aws/aws-sdk-go/service/apprunner"
"github.com/aws/aws-sdk-go/service/appstream"
"github.com/aws/aws-sdk-go/service/appsync"
"github.com/aws/aws-sdk-go/service/athena"
Expand Down Expand Up @@ -146,6 +147,8 @@ func ServiceClientType(serviceName string) string {
funcType = reflect.TypeOf(apigatewayv2.New)
case "appmesh":
funcType = reflect.TypeOf(appmesh.New)
case "apprunner":
funcType = reflect.TypeOf(apprunner.New)
case "appstream":
funcType = reflect.TypeOf(appstream.New)
case "appsync":
Expand Down
28 changes: 28 additions & 0 deletions aws/internal/keyvaluetags/service_tags_gen.go

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

37 changes: 37 additions & 0 deletions aws/internal/keyvaluetags/update_tags_gen.go

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

82 changes: 82 additions & 0 deletions aws/internal/service/apprunner/finder/finder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package finder

import (
"context"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/apprunner"
)

func ConnectionSummaryByName(ctx context.Context, conn *apprunner.AppRunner, name string) (*apprunner.ConnectionSummary, error) {
input := &apprunner.ListConnectionsInput{
ConnectionName: aws.String(name),
}

var cs *apprunner.ConnectionSummary

err := conn.ListConnectionsPagesWithContext(ctx, input, func(page *apprunner.ListConnectionsOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, c := range page.ConnectionSummaryList {
if c == nil {
continue
}

if aws.StringValue(c.ConnectionName) == name {
cs = c
return false
}
}

return !lastPage
})

if err != nil {
return nil, err
}

if cs == nil {
return nil, nil
}

return cs, nil
}

func CustomDomain(ctx context.Context, conn *apprunner.AppRunner, domainName, serviceArn string) (*apprunner.CustomDomain, error) {
input := &apprunner.DescribeCustomDomainsInput{
ServiceArn: aws.String(serviceArn),
}

var customDomain *apprunner.CustomDomain

err := conn.DescribeCustomDomainsPagesWithContext(ctx, input, func(page *apprunner.DescribeCustomDomainsOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, cd := range page.CustomDomains {
if cd == nil {
continue
}

if aws.StringValue(cd.DomainName) == domainName {
customDomain = cd
return false
}
}

return !lastPage
})

if err != nil {
return nil, err
}

if customDomain == nil {
return nil, nil
}

return customDomain, nil
}
14 changes: 14 additions & 0 deletions aws/internal/service/apprunner/id.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package apprunner

import (
"fmt"
"strings"
)

func CustomDomainAssociationParseID(id string) (string, string, error) {
idParts := strings.Split(id, ",")
if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" {
return "", "", fmt.Errorf("unexpected format of ID (%s), expected domain_name,service_arn", id)
}
return idParts[0], idParts[1], nil
}
Loading