-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: OB-37376 merge cf stacks for push and pull by adding poller rol… #342
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,11 @@ Metadata: | |
default: CloudWatch Metrics | ||
Parameters: | ||
- MetricStreamFilterUri | ||
- Label: | ||
default: Cloudwatch Metrics Poller Role | ||
Parameters: | ||
- ObserveAwsAccountId | ||
- DatastreamIds | ||
- Label: | ||
default: Forwarder Options | ||
Parameters: | ||
|
@@ -150,6 +155,18 @@ Parameters: | |
Description: >- | ||
The token used to retrieve metric configuration. | ||
Default: '' | ||
ObserveAwsAccountId: | ||
Type: String | ||
Description: Observe AWS Account ID which will be allowed to assume role. | ||
AllowedPattern: '\d*' | ||
Default: '' | ||
DatastreamIds: | ||
Type: CommaDelimitedList | ||
Description: Datastream IDs where data will be ingested to. | ||
This ensures Observe cannot assume this role outside | ||
of this context. | ||
AllowedPattern: \d* | ||
Default: '' | ||
SourceBucketNames: | ||
Type: CommaDelimitedList | ||
Description: >- | ||
|
@@ -214,7 +231,10 @@ Conditions: | |
- !Equals | ||
- !Ref DatasourceID | ||
- "" | ||
|
||
EnableMetricsPollerRole: !Not | ||
- !Equals | ||
- !Ref ObserveAwsAccountId | ||
- "" | ||
Resources: | ||
Topic: | ||
Type: "AWS::SNS::Topic" | ||
|
@@ -378,6 +398,22 @@ Resources: | |
- UseStackName | ||
- !Sub "${AWS::StackName}-MetricStream" | ||
- !Sub "${NameOverride}-MetricStream" | ||
MetricsPollerRole: | ||
Type: AWS::Serverless::Application | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this "application" is just a role and a policy? and you've already added that to the stack? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you mean by already - the nested stack |
||
Condition: EnableMetricsPollerRole | ||
Properties: | ||
Location: ../externalrole/template.yaml | ||
NotificationARNs: | ||
- !Ref Topic | ||
Parameters: | ||
ObserveAwsAccountId: !Ref ObserveAwsAccountId | ||
AllowedActions: >- | ||
cloudwatch:GetMetricData,cloudwatch:ListMetrics,tag:GetResources | ||
DatastreamIds: !Join [",", !Ref DatastreamIds] | ||
NameOverride: !If | ||
- UseStackName | ||
- !Sub "${AWS::StackName}-MetricsPollerRole" | ||
- !Sub "${NameOverride}-MetricsPollerRole" | ||
Outputs: | ||
BucketName: | ||
Description: >- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this check going to happen on the poller side? its not happening in the sam app side right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you referring to the validity of the ObserveAwsAccountId? I thought this would happen based on the frontend passing in correct input. I'll hardcode AllowedActions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean why do they need to know datastreamIds at all? The whole point is to just add an iam policy and allow our poller iam role to assume it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because of how AWS recommends allowing other accounts to access your resources: see here. It seems that it is possible to do this process without having an external id, but it is not recommended. This is also how the poller works currently - we pass in the datastreamIds (terraform) and then we use it to assume roles. We take it as input here and use it to get credentials we can use in our polling. So the stack here is just checking that the request is coming from our backend.