added default tags to main.tf (iac managed = terraform)
pipeline ran and new duplicate ec2 instance was created.
output from build log:
[Container] 2024/10/26 17:49:19.378307 Running on CodeBuild On-demand
[Container] 2024/10/26 17:49:19.378316 Waiting for agent ping
[Container] 2024/10/26 17:49:21.084417 Waiting for DOWNLOAD_SOURCE
[Container] 2024/10/26 17:49:21.402378 Phase is DOWNLOAD_SOURCE
[Container] 2024/10/26 17:49:21.560456 CODEBUILD_SRC_DIR=/codebuild/output/src4050978961/src
[Container] 2024/10/26 17:49:21.560931 YAML location is /codebuild/output/src4050978961/src/buildspec.yml
[Container] 2024/10/26 17:49:21.562535 Setting HTTP client timeout to higher timeout for S3 source
[Container] 2024/10/26 17:49:21.562811 Processing environment variables
[Container] 2024/10/26 17:49:21.578959 Moving to directory /codebuild/output/src4050978961/src
[Container] 2024/10/26 17:49:21.580026 Unable to initialize cache download: no paths specified to be cached
[Container] 2024/10/26 17:49:21.580288 Registering with agent
[Container] 2024/10/26 17:49:21.740973 Phases found in YAML: 2
[Container] 2024/10/26 17:49:21.741000 POST_BUILD: 1 commands
[Container] 2024/10/26 17:49:21.741005 BUILD: 3 commands
[Container] 2024/10/26 17:49:21.741264 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2024/10/26 17:49:21.741276 Phase context status code: Message:
[Container] 2024/10/26 17:49:21.900022 Entering phase INSTALL
[Container] 2024/10/26 17:49:21.903259 Phase complete: INSTALL State: SUCCEEDED
[Container] 2024/10/26 17:49:21.903275 Phase context status code: Message:
[Container] 2024/10/26 17:49:21.938359 Entering phase PRE_BUILD
[Container] 2024/10/26 17:49:21.939970 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2024/10/26 17:49:21.939988 Phase context status code: Message:
[Container] 2024/10/26 17:49:21.973243 Entering phase BUILD
[Container] 2024/10/26 17:49:22.131241 Running command echo "Building..."
Building...
[Container] 2024/10/26 17:49:22.134870 Running command terraform init
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 4.16"...
- Installing hashicorp/aws v4.67.0...
- Installed hashicorp/aws v4.67.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
[Container] 2024/10/26 17:49:25.468405 Running command terraform plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_instance.app_server will be created
+ resource "aws_instance" "app_server" {
+ ami = "ami-0acc77abdfc7ed5a6"
+ arn = (known after apply)
+ associate_public_ip_address = (known after apply)
+ availability_zone = (known after apply)
+ cpu_core_count = (known after apply)
+ cpu_threads_per_core = (known after apply)
+ disable_api_stop = (known after apply)
+ disable_api_termination = (known after apply)
+ ebs_optimized = (known after apply)
+ get_password_data = false
+ host_id = (known after apply)
+ host_resource_group_arn = (known after apply)
+ iam_instance_profile = (known after apply)
+ id = (known after apply)
+ instance_initiated_shutdown_behavior = (known after apply)
+ instance_state = (known after apply)
+ instance_type = "t2.micro"
+ ipv6_address_count = (known after apply)
+ ipv6_addresses = (known after apply)
+ key_name = (known after apply)
+ monitoring = (known after apply)
+ outpost_arn = (known after apply)
+ password_data = (known after apply)
+ placement_group = (known after apply)
+ placement_partition_number = (known after apply)
+ primary_network_interface_id = (known after apply)
+ private_dns = (known after apply)
+ private_ip = (known after apply)
+ public_dns = (known after apply)
+ public_ip = (known after apply)
+ secondary_private_ips = (known after apply)
+ security_groups = (known after apply)
+ source_dest_check = true
+ subnet_id = (known after apply)
+ tags = {
+ "Name" = "sandboxTestInstance"
}
+ tags_all = {
+ "Name" = "sandboxTestInstance"
+ "iac_managed" = "terraform"
}
+ tenancy = (known after apply)
+ user_data = (known after apply)
+ user_data_base64 = (known after apply)
+ user_data_replace_on_change = false
+ vpc_security_group_ids = (known after apply)
+ capacity_reservation_specification (known after apply)
+ cpu_options (known after apply)
+ ebs_block_device (known after apply)
+ enclave_options (known after apply)
+ ephemeral_block_device (known after apply)
+ maintenance_options (known after apply)
+ metadata_options (known after apply)
+ network_interface (known after apply)
+ private_dns_name_options (known after apply)
+ root_block_device (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
[Container] 2024/10/26 17:49:29.100501 Phase complete: BUILD State: SUCCEEDED
[Container] 2024/10/26 17:49:29.100521 Phase context status code: Message:
[Container] 2024/10/26 17:49:29.143175 Entering phase POST_BUILD
[Container] 2024/10/26 17:49:29.143999 Running command terraform apply -auto-approve
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_instance.app_server will be created
+ resource "aws_instance" "app_server" {
+ ami = "ami-0acc77abdfc7ed5a6"
+ arn = (known after apply)
+ associate_public_ip_address = (known after apply)
+ availability_zone = (known after apply)
+ cpu_core_count = (known after apply)
+ cpu_threads_per_core = (known after apply)
+ disable_api_stop = (known after apply)
+ disable_api_termination = (known after apply)
+ ebs_optimized = (known after apply)
+ get_password_data = false
+ host_id = (known after apply)
+ host_resource_group_arn = (known after apply)
+ iam_instance_profile = (known after apply)
+ id = (known after apply)
+ instance_initiated_shutdown_behavior = (known after apply)
+ instance_state = (known after apply)
+ instance_type = "t2.micro"
+ ipv6_address_count = (known after apply)
+ ipv6_addresses = (known after apply)
+ key_name = (known after apply)
+ monitoring = (known after apply)
+ outpost_arn = (known after apply)
+ password_data = (known after apply)
+ placement_group = (known after apply)
+ placement_partition_number = (known after apply)
+ primary_network_interface_id = (known after apply)
+ private_dns = (known after apply)
+ private_ip = (known after apply)
+ public_dns = (known after apply)
+ public_ip = (known after apply)
+ secondary_private_ips = (known after apply)
+ security_groups = (known after apply)
+ source_dest_check = true
+ subnet_id = (known after apply)
+ tags = {
+ "Name" = "sandboxTestInstance"
}
+ tags_all = {
+ "Name" = "sandboxTestInstance"
+ "iac_managed" = "terraform"
}
+ tenancy = (known after apply)
+ user_data = (known after apply)
+ user_data_base64 = (known after apply)
+ user_data_replace_on_change = false
+ vpc_security_group_ids = (known after apply)
+ capacity_reservation_specification (known after apply)
+ cpu_options (known after apply)
+ ebs_block_device (known after apply)
+ enclave_options (known after apply)
+ ephemeral_block_device (known after apply)
+ maintenance_options (known after apply)
+ metadata_options (known after apply)
+ network_interface (known after apply)
+ private_dns_name_options (known after apply)
+ root_block_device (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
aws_instance.app_server: Creating...
aws_instance.app_server: Still creating... [10s elapsed]
aws_instance.app_server: Creation complete after 12s [id=i-0efe97a7718cb117e]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
[Container] 2024/10/26 17:49:45.822847 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2024/10/26 17:49:45.822867 Phase context status code: Message:
[Container] 2024/10/26 17:49:45.863944 Set report auto-discover timeout to 5 seconds
[Container] 2024/10/26 17:49:45.864101 Expanding base directory path: .
[Container] 2024/10/26 17:49:45.865174 Assembling file list
[Container] 2024/10/26 17:49:45.865186 Expanding .
[Container] 2024/10/26 17:49:45.866296 Expanding file paths for base directory .
[Container] 2024/10/26 17:49:45.866306 Assembling file list
[Container] 2024/10/26 17:49:45.866310 Expanding **/*
[Container] 2024/10/26 17:49:45.867671 No matching auto-discover report paths found
[Container] 2024/10/26 17:49:45.867686 Report auto-discover file discovery took 0.003742 seconds
[Container] 2024/10/26 17:49:45.867697 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2024/10/26 17:49:45.867703 Phase context status code: Message:
added default tags to main.tf (iac managed = terraform) pipeline ran and new duplicate ec2 instance was created.
output from build log: