次に API を試す.LocalStack は一時的な動作確認で使うことも多く,個人的は1時間待つよりは API でサッと消せるのが便利だと思う❗️LocalStack には /_aws/dynamodb/expiredという Amazon DynamoDB TTL 機能専用の API エンドポイントがある👌
The automatically created latest tag shouldn’t be used. A tagging strategy should produce immutable tags. Teams should avoid overwrite tags because this makes it hard to reproduce issues of specific application versions.
$ terraform plan
Terraform will perform the following actions:
# auth0_resource_server.sample will be created
+ resource "auth0_resource_server""sample"{
+ enforce_policies =(known after apply)
+ id =(known after apply)
+ identifier ="https://react.samples.com"
+ name ="ReactSamples"
+ signing_alg ="RS256"
+ signing_secret =(known after apply)
+ skip_consent_for_verifiable_first_party_clients =(known after apply)
+ token_dialect =(known after apply)
+ token_lifetime =(known after apply)
+ token_lifetime_for_web =(known after apply)}
Plan: 1 to add, 0 to change, 0 to destroy.
$ terraform apply
auth0_resource_server.sample: Creating...
auth0_resource_server.sample: Creation complete after 1s [id=xxxxx]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
おー \( 'ω')/
ReactSamples API を追加できた
6. 動作確認をする
追加した Auth0 Application と Auth0 API を使って動作確認をする.今回はサクッと試せる Auth0 React Samplesを使う.
$ terraform plan
Terraform will perform the following actions:
# auth0_connection_client.sample_google_oauth2 will be created
+ resource "auth0_connection_client""sample_google_oauth2"{
+ client_id ="xxxxx"
+ connection_id ="con_xxxxx"
+ id =(known after apply)
+ name =(known after apply)
+ strategy =(known after apply)}# auth0_connection_client.sample_username_password_authentication will be created
+ resource "auth0_connection_client""sample_username_password_authentication"{
+ client_id ="xxxxx"
+ connection_id ="con_xxxxx"
+ id =(known after apply)
+ name =(known after apply)
+ strategy =(known after apply)}
Plan: 2 to add, 0 to change, 0 to destroy.
$ terraform apply
auth0_connection_client.sample_google_oauth2: Creating...
auth0_connection_client.sample_username_password_authentication: Creating...
auth0_connection_client.sample_google_oauth2: Creation complete after 0s [id=con_xxxxx::xxxxx]
auth0_connection_client.sample_username_password_authentication: Creation complete after 0s [id=con_xxxxx::xxxxx]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
$ terraform plan
Terraform will perform the following actions:
# auth0_client.generatesamples will be updated in-place
~ resource "auth0_client""generatesamples"{
+ description ="This is an application to try the `auth0 tf generate` command"
id ="xxxxx"
name ="GenerateSamples"# (21 unchanged attributes hidden)# (3 unchanged blocks hidden)}
Plan: 0 to add, 1 to change, 0 to destroy.
$ terraform apply
auth0_client.generatesamples: Modifying... [id=xxxxx]
auth0_client.generatesamples: Modifications complete after 0s [id=xxxxx]
2024年に読んだ本を年末の振り返りでまとめようと思っていたけど,2024年2月から「毎日10分間読書」という習慣化を始めたことをキッカケにコツコツ読み進められるようになった.中途半端な時期ではあるけど,2024年8月までに読んだ本とその感想(書評記事 or X ポスト)をまとめておこうと思う📝
8ヶ月で「計26冊」読めた❗️技術的な本と仕事で必要なドメイン知識を獲得する本を中心に読んでいた.もともと本を読むのが遅いのにブログに書評記事を書くまでをセットに考えてしまっていて全然進まなかった過去があるけど,2023年から無理に書評記事を書かずに X ポストでも OK という運用に変えて身軽になったのが良かったと思う.
毎日の10分間読書でコツコツ読んでた「Good Code, Bad Code」を読み終えた📕冒頭に読者層として「経験3年以内のソフトウェアエンジニア」とは書いてあるけど,経験年数によらずコードレビューでアドバイスをもらう頻度が高いなら一度読んでみると良さそう✔️ #adhttps://t.co/YcZMiawyPP
$ echo'hello'> hello.txt
$ BUCKET=kakakakakku-sandbox-conditional-writes
$ aws s3api create-bucket \--bucket${BUCKET}\--create-bucket-configurationLocationConstraint=ap-northeast-1
# 1回目
$ aws s3api put-object \--bucket${BUCKET}\--key hello.txt \--body hello.txt \--if-none-match'*'{"ETag": "\"b1946ac92492d2347c6235b4d2611184\"",
"ServerSideEncryption": "AES256"}# 2回目
$ aws s3api put-object \--bucket${BUCKET}\--key hello.txt \--body hello.txt \--if-none-match'*'
An error occurred (PreconditionFailed) when calling the PutObject operation: At least one of the pre-conditions you specified did not hold
$ echo'hello'> hello.txt
$ BUCKET=kakakakakku-sandbox-conditional-writes
$ awslocal s3api create-bucket \--bucket${BUCKET}\--create-bucket-configurationLocationConstraint=ap-northeast-1
# 1回目
$ awslocal s3api put-object \--bucket${BUCKET}\--key hello.txt \--body hello.txt \--if-none-match'*'{"ETag": "\"b1946ac92492d2347c6235b4d2611184\"",
"ServerSideEncryption": "AES256"}# 2回目
$ awslocal s3api put-object \--bucket${BUCKET}\--key hello.txt \--body hello.txt \--if-none-match'*'
An error occurred (PreconditionFailed) when calling the PutObject operation: At least one of the pre-conditions you specified did not hold
$ terraform plan
Terraform will perform the following actions:
# vercel_project.react_admin_tutorial will be created
+ resource "vercel_project""react_admin_tutorial"{
+ auto_assign_custom_domains =true
+ automatically_expose_system_environment_variables =(known after apply)
+ customer_success_code_visibility =(known after apply)
+ directory_listing =(known after apply)
+ framework ="vite"
+ function_failover =(known after apply)
+ git_fork_protection =true
+ git_lfs =(known after apply)
+ git_repository ={
+ production_branch =(known after apply)
+ repo ="kakakakakku/react-admin-tutorial"
+ type="github"}
+ id =(known after apply)
+ name ="react-admin-tutorial"
+ oidc_token_config ={
+ enabled =false}
+ prioritise_production_builds =(known after apply)
+ protection_bypass_for_automation_secret =(known after apply)
+ serverless_function_region =(known after apply)
+ team_id =(known after apply)
+ vercel_authentication ={
+ deployment_type ="standard_protection"}}
Plan: 1 to add, 0 to change, 0 to destroy.
$ terraform plan
Terraform will perform the following actions:
# vercel_deployment.react_admin_tutorial will be created
+ resource "vercel_deployment""react_admin_tutorial"{
+ domains =(known after apply)
+ id =(known after apply)
+ production =(known after apply)
+ project_id ="prj_xxxxx"
+ ref ="main"
+ team_id =(known after apply)
+ url =(known after apply)}
Plan: 1 to add, 0 to change, 0 to destroy.
$ terraform apply
vercel_deployment.react_admin_tutorial: Creating...
vercel_deployment.react_admin_tutorial: Still creating... [10s elapsed]
vercel_deployment.react_admin_tutorial: Still creating... [20s elapsed]
vercel_deployment.react_admin_tutorial: Still creating... [30s elapsed]
vercel_deployment.react_admin_tutorial: Still creating... [40s elapsed]
vercel_deployment.react_admin_tutorial: Creation complete after 49s [id=dpl_xxx]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
少し待っているとデプロイされた \( 'ω')/
Vercel に React-Admin Tutorial アプリをデプロイできた 1
Vercel に React-Admin Tutorial アプリをデプロイできた 2
7. Project: terraform plan コマンドと terraform apply コマンドを実行する
$ terraform plan
Terraform will perform the following actions:
# vercel_project_domain.react_admin_tutorial will be created
+ resource "vercel_project_domain""react_admin_tutorial"{
+ domain ="react-admin-tutorial.xxxxx.com"
+ id =(known after apply)
+ project_id ="prj_xxx"
+ team_id =(known after apply)}
Plan: 1 to add, 0 to change, 0 to destroy.
$ terraform apply
vercel_project_domain.react_admin_tutorial: Creating...
vercel_project_domain.react_admin_tutorial: Creation complete after 1s [id=react-admin-tutorial.xxxxx.com]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
まずは Amazon Cognito User Pools を作っておく❗️今回はサクッと認証を試すためにアプリケーションクライアントの認証フローとして ALLOW_USER_PASSWORD_AUTHも有効化する.あとカスタム属性として X アカウント名を表す custom:xを追加しておく.その他はデフォルト設定で良いかなと思う👌
トークンを取得する(トークン生成前トリガーなし)
まずは「トークン生成前トリガーなし」でトークン (ID Token) を取得する.AWS CLI で aws cognito-idp initiate-authコマンドを実行する💡