CDLUC3 / dmsp_aws_prototype

Sceptre CloudFormation templates for DMPHub v2
MIT License
1 stars 0 forks source link

Adding AWS Chatbot to stack and added GRAPHQL_ENDPOINT environment variable #141

Closed jupiter007 closed 1 month ago

jupiter007 commented 1 month ago

This is my stab at adding AWS Chatbot to the Cloudformation template, as well as adding an environment variable, GRAPHQL_ENDPOINT, for the frontend.

jupiter007 commented 1 month ago

Hi @briri. I made the updates you suggested, and then made some additional changes based on errors I was getting during the creation of the chatbot stack. For example, one error said that I was required to have a ConfigurationNameParameter.

I ran sceptre create dev/regional/chatbot.yaml and it finally ran successfully, and I was able to see notifications being sent to the dmptool-ci slack channel when I reran the frontend pipeline.

jupiter007 commented 1 month ago

ChatbotSnsTopic

Thanks @briri. I changed the ConfigurationName to be dynamic.

One thing that I still have to figure out is that the GRAPHQL_ENDPOINT value is not being found. Will have to research how I can add the correct value so that it can be found by process.env

jupiter007 commented 1 month ago

Actually, I just updated the Dockerfile in my frontend app to include the env variable instead of trying to set it in the Cloudformation template, and that worked.

@briri I noticed that even though the Cloudformation template is adding a chatbot client, it appears to be adding several SNS topics, but I think we just need one: image

briri commented 1 month ago

Interesting. Those might be leftover from the one you created via the console.

One way to find out would be to delete the cloud formation stack which will delete all of the associated resources. Once you've done that, we can then clean out any chatbot SNS topics, IAM Roles/Polices, and the chatbot itself that were created via the console.

jupiter007 commented 1 month ago

Interesting. Those might be leftover from the one you created via the console.

One way to find out would be to delete the cloud formation stack which will delete all of the associated resources. Once you've done that, we can then clean out any chatbot SNS topics, IAM Roles/Polices, and the chatbot itself that were created via the console.

Actually the AWS Chatbot guidelines say that we first have to do some configuration in the AWS Console, which I did. But I can remove the chatbot Cloudformation stack and the SNS topics and IAM Roles/Policies and run the sceptre commands again to see what I get.

jupiter007 commented 1 month ago

@briri - Ok, I deleted all the chatbot configurations, and ran the sceptre create command for chatbot again, and I get two SNS topics: image

The reason this is happening is because of this code in chatbot.yaml: image

I believe we only need the "!GetAtt ChatbotSnsTopic.TopicArn" topic. What do you think?

briri commented 1 month ago

Ok. Did you have to create a CodeStar connection so that slack could communicate with Slack? CodeStar connections have to be created manually in the console. I didn't notice initially that one mentioned CodeStar

jupiter007 commented 1 month ago

Ok. Did you have to create a CodeStar connection so that slack could communicate with Slack? CodeStar connections have to be created manually in the console. I didn't notice initially that one mentioned CodeStar

I didn't have to create a CodeStar connection when I created the channel in the Slack workspace in the AWS Console. So maybe we don't need it?