File tree Expand file tree Collapse file tree 5 files changed +41
-20
lines changed Expand file tree Collapse file tree 5 files changed +41
-20
lines changed Original file line number Diff line number Diff line change 1
- # Module name using following format (< provider >- terraform-< description >, example: azure-terraform-vnet)
1
+ # terraform-azure-vm-initialize-disks
2
2
3
- <Module description >
3
+ Initializes and mounts data disks attached to an Azure VM
4
+ Adds user ` softcatadmin ` with existing default password.
4
5
5
- It supports creating:
6
-
7
- - list resources created by module
8
-
9
- <Describe any submodules >
10
6
11
7
## Usage Examples
12
8
You can go to the tests folder, or review the examples folder: [ examples] ( ./examples )
37
33
- [ Terraform Provider for Azure] ( https://github.com/hashicorp/terraform-provider-azurerm )
38
34
- CLI Tool [ az] ( https://docs.microsoft.com/en-us/cli/azure/ )
39
35
40
- AWS
41
- - [ Terraform Provider for AWS] ( https://github.com/hashicorp/terraform-provider-aws )
42
- - CLI Tool [ aws-cli] ( https://aws.amazon.com/cli/ )
43
-
44
- GCP
45
- - [ Terraform Provider for GCP] ( https://github.com/hashicorp/terraform-provider-google )
46
- - [ Terraform Provider for GCP Beta] ( https://github.com/terraform-providers/terraform-provider-google-beta )
47
- - CLI Tool [ gcloud] ( https://cloud.google.com/sdk/gcloud/ )
48
-
49
36
50
- <Any configuration needed on cloud plartform such as: >
51
- - Service Principals
52
- - IAM Roles
53
- - Service Accounts
54
37
55
38
56
39
## Contributing
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Provision data disks
4
+ cd /dev/disk/azure/scsi1/ || exit
5
+
6
+ for LUN in *
7
+ do
8
+ NUM=$( echo " $LUN " | grep -o -E " [0-9]+" )
9
+ if [ -d " /mnt/data$NUM " ]; then
10
+ echo " Disk Exists" ;
11
+ else
12
+ echo " y" | mkfs.ext4 /dev/disk/azure/scsi1/" $LUN " ;
13
+ mkdir /mnt/data" $NUM " ;
14
+ echo " /dev/disk/azure/scsi1/$LUN /mnt/data$NUM ext4 defaults,nofail 0 0" >> /etc/fstab;
15
+ fi
16
+ done
17
+
18
+ mount -a
19
+
20
+ # Add Softcatadmin user
21
+ if id -u " softcatadmin" > /dev/null 2>&1 ; then
22
+ echo " softcatadmin exists" ;
23
+ else
24
+ useradd -md /home/softcatadmin softcatadmin;
25
+ usermod -aG sudo softcatadmin;
26
+ echo softcatadmin:" ${password} " | chpasswd;
27
+ fi
Original file line number Diff line number Diff line change
1
+ # # Linux
2
+
3
+ variable "vm_password" {
4
+ description = " Password to connect to VM"
5
+ type = string
6
+ }
7
+
8
+ variable "virtual_machine_id" {
9
+ description = " The virtual machine ID disks are attached to"
10
+ type = string
11
+ }
You can’t perform that action at this time.
0 commit comments