Skip to content

Instantly share code, notes, and snippets.

@TwiN
Created March 29, 2022 02:54
Show Gist options
  • Save TwiN/1a6b51e202c7c1af1742c5a429219c8d to your computer and use it in GitHub Desktop.
Save TwiN/1a6b51e202c7c1af1742c5a429219c8d to your computer and use it in GitHub Desktop.
apiVersion: sqs.aws.crossplane.io/v1beta1
kind: Queue
metadata:
name: {{ .Release.Name }}
spec:
deletionPolicy: Delete
forProvider:
region: {{ .Values.awsRegion }}
delaySeconds: 1
messageRetentionPeriod: 604800
visibilityTimeout: 600
policy: |
{
"Version": "2012-10-17",
"Id": "AllowSNSTopicToSendMessagesToSQSQueue",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "SQS:SendMessage",
"Resource": "arn:aws:sqs:{{ .Values.awsRegion }}:{{ .Values.awsAccount }}:{{ .Release.Name }}",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "arn:aws:sns:{{ .Values.awsRegion }}:{{ .Values.awsAccount }}:{{ .Release.Name }}"
}
}
}
]
}
providerConfigRef:
name: crossplane-provider-config
providerRef:
name: crossplane-provider-config
---
apiVersion: notification.aws.crossplane.io/v1alpha1
kind: SNSTopic
metadata:
name: {{ .Release.Name }}
spec:
forProvider:
region: {{ .Values.awsRegion }}
name: {{ .Release.Name }}
displayName: {{ .Release.Name }}
policy: |
{
"Version": "2008-10-17",
"Id": "SNSTopicPolicy",
"Statement": [
{
"Sid": "AllowEverythingFromAccount",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"SNS:GetTopicAttributes",
"SNS:SetTopicAttributes",
"SNS:AddPermission",
"SNS:RemovePermission",
"SNS:DeleteTopic",
"SNS:Subscribe",
"SNS:ListSubscriptionsByTopic",
"SNS:Publish",
"SNS:Receive"
],
"Resource": "arn:aws:sns:{{ .Values.awsRegion }}:{{ .Values.awsAccount }}:{{ .Release.Name }}",
"Condition": {
"StringEquals": {
"AWS:SourceOwner": "{{ .Values.awsAccount }}"
}
}
}
]
}
providerConfigRef:
name: crossplane-provider-config
providerRef:
name: crossplane-provider-config
---
apiVersion: notification.aws.crossplane.io/v1alpha1
kind: SNSSubscription
metadata:
name: {{ .Release.Name }}
spec:
forProvider:
endpoint: 'arn:aws:sqs:{{ .Values.awsRegion }}:{{ .Values.awsAccount }}:{{ .Release.Name }}'
protocol: sqs
region: '{{ .Values.awsRegion }}'
topicArn: 'arn:aws:sns:{{ .Values.awsRegion }}:{{ .Values.awsAccount }}:{{ .Release.Name }}'
providerRef:
name: crossplane-provider-config
providerConfigRef:
name: crossplane-provider-config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment