File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9191
9292# Management of the creation of the s3 bucket.
9393#
94- res=$( aws s3api create-bucket --bucket ${NAME} \
95- --region ${REGION} \
96- --create-bucket-configuration LocationConstraint=${REGION} \
97- --acl private 2>&1 )
98-
9994echo " Creating bucket : ${NAME} "
100- case $res in
101- * " BucketAlreadyOwnedByYou" * )
102- echo " Bucket already owned !"
103- ;;
104- * " BucketAlreadyExists" * )
105- echo " Bucket already exists !"
106- exit 1
107- ;;
108- \S )
109- echo ${res}
110- exit 1
111- ;;
112- esac
95+ res=$( aws s3api create-bucket --bucket ${NAME} \
96+ --region ${REGION} \
97+ --create-bucket-configuration LocationConstraint=${REGION} \
98+ --acl private 2>&1 )
99+ if [ $? -ne 0 ]; then
100+ case $res in
101+ * " BucketAlreadyOwnedByYou" * )
102+ echo " Bucket already owned !"
103+ ;;
104+ * " BucketAlreadyExists" * )
105+ echo " Bucket already exists !"
106+ exit 1
107+ ;;
108+ * )
109+ echo " Error: ${res} "
110+ exit 1
111+ ;;
112+ esac
113+ fi
113114
114115# Management of the bucket public access block configuration.
115116#
@@ -139,13 +140,16 @@ if [ "$CREATE_DYNAMODB" == true ]; then
139140 --key-schema AttributeName=LockID,KeyType=HASH \
140141 --billing-mode PAY_PER_REQUEST 2>&1 )
141142
142- case $res in
143- * " ResourceInUseException" * )
144- echo " DynamoDB table already owned !"
145- ;;
146- \S )
147- echo ${res}
148- exit 1
149- ;;
150- esac
143+ if [ $? -ne 0 ]; then
144+ case $res in
145+ * " ResourceInUseException" * )
146+ echo " DynamoDB table already owned !"
147+ exit 1
148+ ;;
149+ * )
150+ echo " Error: ${res} "
151+ exit 1
152+ ;;
153+ esac
154+ fi
151155fi
You can’t perform that action at this time.
0 commit comments