]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
add user auth to ha template
authorAngus Salkeld <asalkeld@redhat.com>
Mon, 4 Jun 2012 23:34:40 +0000 (09:34 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 5 Jun 2012 01:01:42 +0000 (11:01 +1000)
Change-Id: I044d153bc33de08c6736fd4dd32380ceb0bf8caa
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
templates/WordPress_Single_Instance_With_HA.template

index 71be20ad89b980a0ea41b9a13d1d15b3da6377f2..1f6857e07a8fca179716874393fae929a6036ac0 100644 (file)
   },
 
   "Resources" : {
+    "CfnUser" : {
+      "Type" : "AWS::IAM::User"
+    },
+    "WebServerKeys" : {
+      "Type" : "AWS::IAM::AccessKey",
+      "Properties" : {
+        "UserName" : {"Ref": "CfnUser"}
+      }
+    },
     "WebServerRestartPolicy" : {
       "Type" : "HEAT::HA::Restarter",
       "Properties" : {
         "AlarmDescription": "Restart the WikiDatabase if httpd fails > 3 times in 10 minutes",
         "MetricName": "ServiceFailure",
         "Namespace": "system/linux",
-        "Statistic": "Maximum",
+        "Statistic": "SampleCount",
         "Period": "300",
         "EvaluationPeriods": "1",
         "Threshold": "2",
             "files" : {
               "/etc/cfn/cfn-credentials" : {
                 "content" : { "Fn::Join" : ["", [
-                  "AWSAccessKeyId=GobbleGobble\n",
-                  "AWSSecretKey=Fn_GetAtt_WebServerKeys_SecretAccessKey\n"
+                  "AWSAccessKeyId=", { "Ref" : "WebServerKeys" }, "\n",
+                  "AWSSecretKey=", {"Fn::GetAtt": ["WebServerKeys",
+                                    "SecretAccessKey"]}, "\n"
                 ]]},
                 "mode"    : "000400",
                 "owner"   : "root",
           "  exit 1\n",
           "}\n",
 
-          "/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackName" }, " -r WikiDatabase ",
-          "    --region ", { "Ref" : "AWS::Region" }, " || error_exit 'Failed to run cfn-init'\n",
+          "/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackName" },
+          " -r WikiDatabase ",
+          " --access-key ", { "Ref" : "WebServerKeys" },
+          " --secret-key ", {"Fn::GetAtt": ["WebServerKeys", "SecretAccessKey"]},
+          " --region ", { "Ref" : "AWS::Region" },
+          " || error_exit 'Failed to run cfn-init'\n",
 
           "# Setup MySQL root password and create a user\n",
           "mysqladmin -u root password '", { "Ref" : "DBRootPassword" },