diff --git a/.github/workflows/daily_update.yml b/.github/workflows/daily_update.yml index 4c842e0..8afe6e5 100644 --- a/.github/workflows/daily_update.yml +++ b/.github/workflows/daily_update.yml @@ -34,12 +34,6 @@ jobs: with: terraform_version: 1.6.5 # Replace with your desired Terraform version - - name: Import Database into Terraform - run: terraform import aws_db_instance.terraform_blog_example terraform-blog-example - - - name: Import Parameter group into Terraform - run: terraform import aws_db_parameter_group.terraform_blog_example terraform-blog-example-pg - - name: Initialize Terraform run: terraform init diff --git a/db_params.tf b/db_params.tf index 3e3cf38..cf8a749 100644 --- a/db_params.tf +++ b/db_params.tf @@ -1,5 +1,10 @@ # AWS RDS PostgreSQL Parameter Group Configuration +import { + to = aws_db_parameter_group.terraform_blog_example + id = "terraform-blog-example-pg" +} + resource "aws_db_parameter_group" "terraform_blog_example" { name = "terraform-blog-example-pg" # Name of the DB parameter group family = "postgres15" # Database family (PostgreSQL 15.x in this case) diff --git a/main.tf b/main.tf index 752a9c6..d4cdb0b 100644 --- a/main.tf +++ b/main.tf @@ -9,6 +9,10 @@ provider "aws" { # Set environment variable `TF_VAR_db_password="your_secure_password"` variable "db_password" {} +import { + to = aws_db_instance.terraform_blog_example + id = "terraform-blog-example" +} # AWS RDS PostgreSQL instance creation using Terraform resource "aws_db_instance" "terraform_blog_example" {