dual-primary: Rename EFS resources for primary stack

Before the introduction of the EFS stack for replicas, there was no
reason to further specify resources related to EFS, since primary gerrit
instances were the only ones leveraging them.

With the introduction of EFS for replicas, the existing naming of
resources related to the primary stack becomes ambiguous.
It is not clear what a "FileSystemId" might refer to, for example,
whether it is supposed to be mounted by primary or replica instances.

Explicitly prefix EFS resources used by primary instances with the
'Primary' prefix, to make their intent explicit.

Change-Id: I1095587cdfa2ea22447e2d277c7172d806744d13
diff --git a/dual-primary/Makefile b/dual-primary/Makefile
index 309d997..7f44c6f 100644
--- a/dual-primary/Makefile
+++ b/dual-primary/Makefile
@@ -54,14 +54,14 @@
 ifdef CLUSTER_INSTANCE_TYPE
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=InstanceType,ParameterValue=$(CLUSTER_INSTANCE_TYPE))
 endif
-ifdef FILESYSTEM_THROUGHPUT_MODE
-		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=FileSystemThroughputMode,ParameterValue=$(FILESYSTEM_THROUGHPUT_MODE))
+ifdef PRIMARY_FILESYSTEM_THROUGHPUT_MODE
+		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=PrimaryFileSystemThroughputMode,ParameterValue=$(PRIMARY_FILESYSTEM_THROUGHPUT_MODE))
 endif
-ifdef FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS
-		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=ProvisionedThroughputInMibps,ParameterValue=$(FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS))
+ifdef PRIMARY_FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS
+		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=PrimaryProvisionedThroughputInMibps,ParameterValue=$(PRIMARY_FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS))
 endif
-ifdef FILESYSTEM_ID
-		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=FileSystemID,ParameterValue=$(FILESYSTEM_ID))
+ifdef PRIMARY_FILESYSTEM_ID
+		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=PrimaryFileSystemID,ParameterValue=$(PRIMARY_FILESYSTEM_ID))
 endif
 ifdef SUBNET_CIDR
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=SubnetCIDR,ParameterValue=$(SUBNET_CIDR))
@@ -495,11 +495,11 @@
 	@echo ""
 	@echo -n "Are you sure you want to continue? [y/N] " && read ans && [ $${ans:-N} = y ]
 
-delete-all-including-retained-stack: confirm-persistent-stack-deletion delete-all delete-git-persistent-stack delete-git-replica-persistent-stack delete-network-persistent-stack
+delete-all-including-retained-stack: confirm-persistent-stack-deletion delete-all delete-git-primary-persistent-stack delete-git-replica-persistent-stack delete-network-persistent-stack
 
-delete-git-persistent-stack:
+delete-git-primary-persistent-stack:
 
-	$(eval EFS_STACK_NAME := $(shell $(AWS_FC_COMMAND) list-stacks --stack-status-filter CREATE_COMPLETE --query "StackSummaries[*].StackName" | jq -r '.[]| select(startswith("$(CLUSTER_STACK_NAME)-GitFileSystemPermanentStack"))'))
+	$(eval EFS_STACK_NAME := $(shell $(AWS_FC_COMMAND) list-stacks --stack-status-filter CREATE_COMPLETE --query "StackSummaries[*].StackName" | jq -r '.[]| select(startswith("$(CLUSTER_STACK_NAME)-PrimaryGitFileSystemPermanentStack"))'))
 
 	$(if $(EFS_STACK_NAME), \
 		$(AWS_FC_COMMAND) delete-stack \
diff --git a/dual-primary/README.md b/dual-primary/README.md
index 7c3e989..baa0874 100644
--- a/dual-primary/README.md
+++ b/dual-primary/README.md
@@ -174,9 +174,9 @@
 * `SSH_HOST_PORT_PRIMARY2:`: Optional. Gerrit Host SSH port for primary2 (must be different from primary1). `29418` by default.
 * `REPLICA_SUBDOMAIN`: Mandatory. The subdomain of the Gerrit replica. For example: `<AWS_PREFIX>-replica`
 * `LB_SUBDOMAIN`: Mandatory. The subdomain of the Gerrit load balancer. For example: `<AWS_PREFIX>-dual-primary`
-* `FILESYSTEM_THROUGHPUT_MODE`: Optional. The throughput mode for the file system to be created.
+* `PRIMARY_FILESYSTEM_THROUGHPUT_MODE`: Optional. The throughput mode for the primary file system to be created.
 default: `bursting`. More info [here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html)
-* `FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS`: Optional. Only used when `FILESYSTEM_THROUGHPUT_MODE` is set to `provisioned`.
+* `PRIMARY_FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS`: Optional. Only used when `PRIMARY_FILESYSTEM_THROUGHPUT_MODE` is set to `provisioned`.
 default: `256`.
 
 * `GERRIT_REPLICA_INSTANCE_ID`: Optional. Identifier for the Gerrit replica instance.
diff --git a/dual-primary/cf-cluster.yml b/dual-primary/cf-cluster.yml
index 7923dc1..17a9b9b 100644
--- a/dual-primary/cf-cluster.yml
+++ b/dual-primary/cf-cluster.yml
@@ -48,17 +48,17 @@
       Description: An environment name used to build the log stream names
       Type: String
       Default: test
-  FileSystemThroughputMode:
-    Description:  Gerrit shared filesystem throughput mode
+  PrimaryFileSystemThroughputMode:
+    Description: Gerrit primary shared filesystem throughput mode
     Type: String
     Default: bursting
     AllowedValues: [bursting, provisioned]
-  FileSystemID:
-    Description: the id of the EFS filesystem to mount
+  PrimaryFileSystemID:
+    Description: Gerrit primary shared filesystem id
     Type: String
     Default: ""
-  ProvisionedThroughputInMibps:
-    Description:  The fs throughput, measured in MiB/s. Valid values are 1-1024.
+  PrimaryProvisionedThroughputInMibps:
+    Description: Gerrit primary filesystem throughput, measured in MiB/s. Valid values are 1-1024.
     Type: Number
     Default: 256
   HAProxyMaxCount:
@@ -108,8 +108,8 @@
     Default: 256
 
 Conditions:
-  isProvisionedThroughput: !Equals [!Ref FileSystemThroughputMode, "provisioned"]
-  CreateEFS: !Equals [!Ref FileSystemID, ""]
+  isProvisionedThroughput: !Equals [!Ref PrimaryFileSystemThroughputMode, "provisioned"]
+  CreatePrimaryEFS: !Equals [!Ref PrimaryFileSystemID, ""]
   CreateReplicaEFS: !Equals [!Ref ReplicaFileSystemID, ""]
   NetworkStackNeeded: !Or
     - !Equals [!Ref VPCIdProp, ""]
@@ -234,7 +234,7 @@
         ECSCluster: !Ref ECSCluster
         EC2SecurityGroup: !Ref EcsHostSecurityGroup
         EC2InstanceProfile: !Ref EC2InstanceProfile
-        FileSystem: !If [CreateEFS, !GetAtt GitFileSystemPermanentStack.Outputs.FileSystemID, !Ref FileSystemID ]
+        FileSystem: !If [CreatePrimaryEFS, !GetAtt PrimaryGitFileSystemPermanentStack.Outputs.FileSystemID, !Ref PrimaryFileSystemID ]
         SubnetId: !If [NetworkStackNeeded, !GetAtt ECSTaskNetworkStack.Outputs.PublicSubnetOneRef, !Ref SubnetIdProp]
         LogGroupName: !Ref AWS::StackName
         PrimaryMaxCount: !Ref PrimaryMaxCount
@@ -258,7 +258,7 @@
         ECSCluster: !Ref ECSCluster
         EC2SecurityGroup: !Ref EcsHostSecurityGroup
         EC2InstanceProfile: !Ref EC2InstanceProfile
-        FileSystem: !If [CreateEFS, !GetAtt GitFileSystemPermanentStack.Outputs.FileSystemID, !Ref FileSystemID ]
+        FileSystem: !If [CreatePrimaryEFS, !GetAtt PrimaryGitFileSystemPermanentStack.Outputs.FileSystemID, !Ref PrimaryFileSystemID ]
         SubnetId: !If [NetworkStackNeeded, !GetAtt ECSTaskNetworkStack.Outputs.PublicSubnetOneRef, !Ref SubnetIdProp]
         LogGroupName: !Ref AWS::StackName
         PrimaryMaxCount: !Ref PrimaryMaxCount
@@ -309,16 +309,16 @@
               - 'ec2:DescribeVolumes'
             Resource: '*'
 
-  GitFileSystemPermanentStack:
+  PrimaryGitFileSystemPermanentStack:
     Type: AWS::CloudFormation::Stack
     DeletionPolicy: Retain
-    Condition: CreateEFS
+    Condition: CreatePrimaryEFS
     Properties:
       TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-efs-stack.yml'] ]
       TimeoutInMinutes: '25'
       Parameters:
-        FileSystemThroughputMode: !Ref FileSystemThroughputMode
-        ProvisionedThroughputInMibps: !Ref ProvisionedThroughputInMibps
+        FileSystemThroughputMode: !Ref PrimaryFileSystemThroughputMode
+        ProvisionedThroughputInMibps: !Ref PrimaryProvisionedThroughputInMibps
         PublicSubnet: !If [NetworkStackNeeded, !GetAtt ECSTaskNetworkStack.Outputs.PublicSubnetOneRef, !Ref SubnetIdProp]
         SecurityGroupVPCID: !If [NetworkStackNeeded, !GetAtt ECSTaskNetworkStack.Outputs.VPCRef, !Ref VPCIdProp]
         SecurityGroupCidrIp: !Ref SubnetCIDR