Terraform

 I share with you some key steps to manage infrastructure as code.

I. Non-Variable

1. Install Terraform:

You can install Terraform by downloading the binary distribution for your operating system from the Terraform website. After downloading, extract the binary and add it to your system's PATH.

2. Define Infrastructure as Code (IaC):

Create a directory for your Terraform configuration files. Within this directory, define .tf files that describe the infrastructure resources you want to provision. These files typically include:

  • Provider Configuration: Declare the cloud provider you're using (e.g., AWS, Azure, Google Cloud) and any required authentication details.
  • Resource Configuration: Define the infrastructure resources you want to create, such as virtual machines, networks, databases, and storage buckets.

3. Initialize Terraform:

Navigate to your Terraform configuration directory in the terminal and run terraform init. This command initializes the directory and downloads any necessary plugins and modules.

4. Write Terraform Configuration:

Write your Terraform configuration files (.tf) using the HashiCorp Configuration Language (HCL). Define providers, resources, variables, outputs, and any other necessary configurations.

5. Plan Infrastructure Changes:

Run terraform plan to create an execution plan. Terraform examines your configuration and determines what actions are necessary to achieve the desired state. It does not execute the plan but shows you what will happen when you apply the configuration.

6. Apply Infrastructure Changes:

Once you review the plan and are satisfied with the proposed changes, you can apply the changes by running terraform apply. Terraform will execute the plan and create, update, or delete resources as needed.

7. Maintain Infrastructure:

As your infrastructure evolves, continue to manage it using Terraform. Make changes to your Terraform configuration files as necessary and apply those changes using terraform apply.

Additional Tips:

  • Version Control: Store your Terraform configuration files in version control (e.g., Git) to track changes and collaborate with team members.
  • Modules: Use Terraform modules to encapsulate reusable components of your infrastructure configuration.
  • Variables and Outputs: Utilize variables to parameterize your configuration and outputs to extract useful information about your infrastructure.

Example Terraform Configuration:

Here's a simple example of a Terraform configuration file that provisions an AWS EC2 instance:

hcl
provider "aws" { 
 region = "ap-southeast-1
}

resource "aws_instance" "example" { 
 ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" 
}

This configuration declares an AWS provider in the us-west-2 region and creates an EC2 instance using the specified AMI and instance type.


II. Variable

1. Create Terraform Variable Files:

Create separate Terraform variable files for each environment (e.g., dev.tfvars, prod.tfvars in envs folder). These files will contain environment-specific variable values.

Example dev.tfvars:

hcl
region = "us-west-2" instance_type = "t2.micro"

Example prod.tfvars:

hcl
region = "us-east-1" instance_type = "t2.large"

2. Reference Variables in Terraform Configuration:

Reference the variables defined in your variable files in your Terraform configuration files using interpolation syntax.

Example main.tf:

hcl
provider "aws" { 
 region = var.region 
}
resource "aws_instance" "example" { 
 ami = "ami-12345678" 
 # AMI ID specific to your environment 
 instance_type = var.instance_type 
}

3. Run Terraform Commands with Variable Files:

When running Terraform commands, specify the variable files for the appropriate environment using the -var-file option.

For example, to apply changes to the development environment:

bash
terraform apply -var-file=../envs/dev.tfvars 

For the production environment:

bash
terraform apply -var-file=../envsprod.tfvars

3. Run Terraform Destroy

Once you're in the directory, execute the following command:

bash
terraform destroy


Additional Tips:

  • Use .gitignore to exclude sensitive variable files (e.g., *.tfvars) from version control.
  • Define default variable values in your Terraform configuration files or in a variables.tf file to provide fallback values if variables are not defined in the variable files.

  •  

After I run terraform apply successfully:






[ERP] Human Resouce & Payroll

 

Introduction

The life cycle of (HRM)/payroll is a recurring set of business activities and related data processing operations associated with effectively managing employee resources. 

The more important tasks include the following:

  1. Recruiting and hiring new employees

  2. Training

  3. Job assignment

  4. Compensation (payroll)

  5. Performance evaluation

  6. Discharge of employees due to voluntary or involuntary termination


The Payroll system, which is under the accounting department’s control, produces employee paychecks and maintains the related records as required by government regulations.


The HRM system, which the human resources department runs, maintains files on employee job history, skills, and benefits; these files are updated weekly.


Cycle Information System

To effectively utilize the organization’s employees, the HRM/payroll system must collect and store the information managers need to answer the following kinds of questions:

  • How many employees does the organization need to accomplish its strategic plans?

  • Which employees possess specific skills?

  • Which skills are in short supply? Which skills are in oversupply?

  • How effective are current training programs in maintaining and improving employee skill levels?

  • Is overall performance improving or declining?

  • Are there problems with turnover, tardiness, or absenteeism?

Overview HRM/Payroll process and Information needs



Payroll context diagram



Data flow diagram



REPORT NAME

CONTENTS

PURPOSE

Cumulative earnings

register

Cumulative year-to-date gross pay, net pay, and deductions for each employee 

Used for employee information and annual payroll reports

Workforce Inventory List of employees by department

Used in preparing labor-related reports for

government agencies

Position control report

List of each authorized position, job qualifications, budgeted salary, and position status (filled or vacant)

Used in planning future workforce needs

Skills inventory report

List of employees and current skills

Useful in planning future workforce needs and training programs

Form 941

Employer’s quarterly federal tax return (showing all wages subject to tax and amounts withheld for income tax and FICA)

Filed quarterly to reconcile monthly tax payments with total tax liability for the quarter

Form W-2

Report of wages and withholdings for each employee

Sent to each employee for use in preparing in

dividual tax returns; due by January 31

Form W-3

Summary of all W-2 forms

Sent to the federal government along with a copy of all W-2 forms; due by February 28

Form 1099-Misc

Report of income paid to independent contractors

Sent to recipients of income for use in filing

their income tax returns; due by January 31

401(k) Retirement



Various other reports to

government agencies

Data on compliance with various regulatory provisions, state and local tax reports, etc.

To document compliance with applicable

regulations





The OCR Service to extract the Text Data

Optical character recognition, or OCR, is a key tool for people who want to build or collect text data. OCR uses machine learning to extract...