Terraformはtfstateファイルで構成情報を管理しているが、 単純にtfstateファイルをgit等で共有すると他の人が構成変更 (terrafrom apply)している最中に別に作業を実行したり出来る。
そういうときに良く競合してあるべきリソースが削除されたりするが Terraform Backend S3 + DynamoDB Lockを利用することで、自動的に ロックしながら最新状態を共有することが可能となる。
#!/usr/bin/env stack | |
{- stack | |
runhaskell | |
--resolver lts-13.18 | |
--package base | |
--package curl | |
--package iproute | |
--package tagsoup | |
--package containers | |
--package data-interval |
let | |
pkgsSrc = (builtins.fetchGit { | |
url = https://github.com/nixos/nixpkgs; | |
ref = "release-19.03"; | |
}); | |
pkgs = import pkgsSrc {}; | |
lib = pkgs.lib; | |
in | |
{ | |
imports = [ |
rm -rf /var/www | |
mkdir -p /var/www | |
chown nginx:nginx /var/www | |
pushd /var/www | |
wget http://wordpress.org/latest.tar.gz | |
mv latest.tar.gz wordpress-$stime.tar.gz | |
tar -zxvf wordpress-$stime.tar.gz | |
mv wordpress default |
{ pkgs, lib, ... }: | |
# let | |
# pkgsSrc = (builtins.fetchGit { | |
# url = https://github.com/nixos/nixpkgs; | |
# ref = "release-19.03"; | |
# }); | |
# pkgs = import pkgsSrc {}; | |
# lib = pkgs.lib; | |
# in | |
with lib; |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
# listen 80; | |
# listen [::]:80; | |
root /var/www/www.example.com; | |
index index.php index.html; | |
server_name www.example.com; | |
location / { | |
try_files $uri $uri/ /index.php$is_args$args =404; |
AWSTemplateFormatVersion: '2010-09-09' | |
Resources: | |
sampleNodejsApp: | |
Type: AWS::ElasticBeanstalk::Application | |
Properties: | |
ApplicationName: sampleNodejsApp | |
Description: AWS Elastic Beanstalk Sample Nodejs Application | |
sampleNodejsAppVersion: | |
Type: AWS::ElasticBeanstalk::ApplicationVersion | |
Properties: |
#include <stdio.h> | |
int main() | |
{ | |
int a = 10, b = 0, c = 10; | |
char* str = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq " | |
"TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBL" | |
"OFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm " | |
"SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; | |
while (a != 0) | |
{ |
#include <stdio.h> | |
int main() { | |
int nc = 0, mode = 0; | |
char* str = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq " | |
"TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBL" | |
"OFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm " | |
"SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; | |
for(;*str != 0; str++, mode = !mode) { | |
for(int mc = *str; mc > '@'; mc--) { |
#include <stdio.h> | |
int main() { | |
int nc = 0, mode = 0; | |
char* str = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq " | |
"TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBL" | |
"OFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm " | |
"SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; | |
for(;*str != 0; str++, mode = !mode) | |
for(int mc = *str; mc > '@'; mc--) |