Skip to content
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
4 changes: 4 additions & 0 deletions internal/pkg/deploy/cloudformation/stack/lb_web_svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package stack
import (
"fmt"
"strconv"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudformation"
Expand Down Expand Up @@ -245,6 +246,9 @@ func (s *LoadBalancedWebService) Template() (string, error) {
NLBCertValidatorFunctionLambda: nlbConfig.certValidatorLambda,
NLBCustomDomainFunctionLambda: nlbConfig.customDomainLambda,
ALBEnabled: !s.manifest.RoutingRule.Disabled(),
Observability: template.ObservabilityOpts{
Tracing: strings.ToUpper(aws.StringValue(s.manifest.Observability.Tracing)),
},
})
if err != nil {
return "", err
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/manifest/lb_web_svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type LoadBalancedWebServiceConfig struct {
TaskDefOverrides []OverrideRule `yaml:"taskdef_overrides"`
NLBConfig NetworkLoadBalancerConfiguration `yaml:"nlb"`
DeployConfig DeploymentConfiguration `yaml:"deployment"`
Observability Observability `yaml:"observability"`
}

// LoadBalancedWebServiceProps contains properties for creating a new load balanced fargate service manifest.
Expand Down
10 changes: 10 additions & 0 deletions internal/pkg/template/templates/workloads/partials/cf/sidecars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
awslogs-group: !Ref LogGroup
awslogs-stream-prefix: copilot
{{- end}}
{{- if eq .Observability.Tracing "AWSXRAY"}}
- Name: aws-otel-collector
Image: public.ecr.aws/aws-observability/aws-otel-collector:latest
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-region: !Ref AWS::Region
awslogs-group: !Ref LogGroup
awslogs-stream-prefix: copilot
Comment thread
dannyrandall marked this conversation as resolved.
{{- end}}
{{- range $sidecar := .Sidecars}}
- Name: {{$sidecar.Name}}
Image: {{$sidecar.Image}}
Expand Down
23 changes: 20 additions & 3 deletions internal/pkg/template/templates/workloads/partials/cf/taskrole.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TaskRole:
Type: AWS::IAM::Role
Properties:{{if .NestedStack}}{{$stackName := .NestedStack.StackName}}{{if gt (len .NestedStack.PolicyOutputs) 0}}
ManagedPolicyArns:{{range $managedPolicy := .NestedStack.PolicyOutputs}}
- Fn::GetAtt: [{{$stackName}}, Outputs.{{$managedPolicy}}]{{end}}{{end}}{{end}}
- Fn::GetAtt: [{{$stackName}}, Outputs.{{$managedPolicy}}]{{end}}{{end}}{{end}}
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Expand Down Expand Up @@ -102,5 +102,22 @@ TaskRole:
- !Ref {{logicalIDSafe $topic.Name}}SNSTopic
{{- end}}
{{- end}}{{- end}}


{{- if eq .Observability.Tracing "AWSXRAY"}}
- PolicyName: 'AWSDistroOpenTelemetryPolicy'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'logs:PutLogEvents'
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:DescribeLogStreams'
- 'logs:DescribeLogGroups'
- 'xray:PutTraceSegments'
- 'xray:PutTelemetryRecords'
- 'xray:GetSamplingRules'
- 'xray:GetSamplingTargets'
- 'xray:GetSamplingStatisticSummaries'
Resource: "*"
{{- end}}