Having an issue with Terraform. Even when I run `t...
# ask-metaflow
c
Having an issue with Terraform. Even when I run
terraform init
new values are not changed in the
.terraform
folder. Even in the case of predefined values. This is what is defined in the repository
Copy code
resource "aws_lambda_function" "db_migrate_lambda" {
  function_name    = local.db_migrate_lambda_name
  handler          = "index.handler"
  runtime          = "python3.12"
  memory_size      = 128
  timeout          = 900
This is what is generated in the
.terraform
Copy code
runtime                        = "python3.7"
It seems to me that
terraform init
is pulling in files from an old git commit or something. Any help would be appreciated
πŸ‘€ 2
h
Are you still facing this issue? You can force a clean init by deleting the
.terraform
folder incase your local dependencies got into a weird state.
c
I am still facing this. I did delete
.terraform
and even recloned the repository. Same problem.
I'll add that I'm on a mac and installed terraform through homebrew if thats important
h
I use
tfswitch
but don't think that matters. Can you please share the specific error you are getting?
c
Terraform issue The original issue I had was with the db instance it just needs to be updated to db.t3.small. But when I change the value in variables.tf the value is not updated. to make it update I need to go into the
.terraform
directory and change a value in there then it updates. See below for the details Fresh clone in a new folder git clone git@github.com:outerbounds/terraform-aws-metaflow.git Choosing examples/eks_argo Terraform v1.8.0 terraform init terraform init Initializing the backend... Initializing modules... Downloading git::ssh://git@github.com/outerbounds/metaflow-tools?ref=v2.0.0 for argo_events... - argo_events in .terraform/modules/argo_events/common/terraform/argo_events Downloading registry.terraform.io/terraform-aws-modules/eks/aws 17.23.0 for eks... - eks in .terraform/modules/eks - eks.fargate in .terraform/modules/eks/modules/fargate - eks.node_groups in .terraform/modules/eks/modules/node_groups Downloading registry.terraform.io/outerbounds/metaflow/aws 0.10.0 for metaflow-common... - metaflow-common in .terraform/modules/metaflow-common/modules/common Downloading registry.terraform.io/outerbounds/metaflow/aws 0.10.0 for metaflow-datastore... - metaflow-datastore in .terraform/modules/metaflow-datastore/modules/datastore Downloading registry.terraform.io/outerbounds/metaflow/aws 0.10.0 for metaflow-metadata-service... - metaflow-metadata-service in .terraform/modules/metaflow-metadata-service/modules/metadata-service - metaflow-metadata-service.metaflow-common in .terraform/modules/metaflow-metadata-service/modules/common Downloading registry.terraform.io/terraform-aws-modules/vpc/aws 5.1.2 for vpc... - vpc in .terraform/modules/vpc Initializing provider plugins... - Finding terraform-aws-modules/http versions matching ">= 2.4.1"... - Finding hashicorp/aws versions matching ">= 3.38.0, >= 3.40.0, >= 3.54.0, >= 3.56.0, != 4.0.0, != 4.1.0, != 4.2.0, != 4.3.0, != 4.4.0, != 4.5.0, != 4.6.0, != 4.7.0, != 4.8.0, >= 5.0.0"... - Finding hashicorp/random versions matching ">= 2.1.0"... - Finding latest version of hashicorp/helm... - Finding hashicorp/local versions matching ">= 1.4.0"... - Finding hashicorp/kubernetes versions matching ">= 1.11.1"... - Finding latest version of hashicorp/archive... - Finding hashicorp/cloudinit versions matching ">= 2.0.0"... - Installing terraform-aws-modules/http v2.4.1... - Installed terraform-aws-modules/http v2.4.1 (self-signed, key ID B2C1C0641B6B0EB7) - Installing hashicorp/aws v5.45.0... - Installed hashicorp/aws v5.45.0 (signed by HashiCorp) - Installing hashicorp/random v3.6.1... - Installed hashicorp/random v3.6.1 (signed by HashiCorp) - Installing hashicorp/helm v2.13.1... - Installed hashicorp/helm v2.13.1 (signed by HashiCorp) - Installing hashicorp/local v2.5.1... - Installed hashicorp/local v2.5.1 (signed by HashiCorp) - Installing hashicorp/kubernetes v2.29.0... - Installed hashicorp/kubernetes v2.29.0 (signed by HashiCorp) - Installing hashicorp/archive v2.4.2... - Installed hashicorp/archive v2.4.2 (signed by HashiCorp) - Installing hashicorp/cloudinit v2.3.3... - Installed hashicorp/cloudinit v2.3.3 (signed by HashiCorp) Partner and community providers are signed by their developers. If you'd like to know more about provider signing, you can read about it here: https://www.terraform.io/docs/cli/plugins/signing.html 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. terraform apply ….. InvalidParameterCombination: RDS does not support creating a DB instance with the following combination: DBInstanceClass=db.t2.small, Engine=postgres, EngineVersion=11.22, LicenseModel=postgresql-license. For supported combinations of instance class and database engine version, see the documentation. Now if I go and change the value in variables.tf variable "db_instance_type" { type = string description = "RDS instance type to launch for PostgresQL database." default = "db.t2.small" } To variable "db_instance_type" { type = string description = "RDS instance type to launch for PostgresQL database." default = "db.t3.small" } terraform plan or apply # module.metaflow-datastore.aws_db_instance.this[0] will be created + resource "aws_db_instance" "this" { + address = (known after apply) + allocated_storage = 20 + apply_immediately = false + arn = (known after apply) + auto_minor_version_upgrade = true + availability_zone = (known after apply) + backup_retention_period = (known after apply) + backup_target = (known after apply) + backup_window = (known after apply) + ca_cert_identifier = (known after apply) + character_set_name = (known after apply) + copy_tags_to_snapshot = false + db_name = "metaflow" + db_subnet_group_name = "metaflowmainert7vn1u" + delete_automated_backups = true + domain_fqdn = (known after apply) + endpoint = (known after apply) + engine = "postgres" + engine_version = "11" + engine_version_actual = (known after apply) + final_snapshot_identifier = "metaflowmetaflow-final-snapshotert7vn1u-fair-aardvark" + hosted_zone_id = (known after apply) + id = (known after apply) + identifier = "metaflowmetaflowert7vn1u" + identifier_prefix = (known after apply) + instance_class = "db.t2.small”. <β€”β€”β€”β€”β€”β€” Still db.t2.small
I found the problem the
metaflow-datastore
is pulling from the terraform registry and not reading any local changes I fixed it this way
Copy code
module "metaflow-datastore" {
  source  = "../../modules/datastore" <----- Edited this to point locally.
  #version = "0.10.0". <-------------------- Commented out to not need a version.

  force_destroy_s3_bucket = true

  resource_prefix = local.resource_prefix
  resource_suffix = local.resource_suffix

  metadata_service_security_group_id = module.metaflow-metadata-service.metadata_service_security_group_id
  metaflow_vpc_id                    = module.vpc.vpc_id
  subnet1_id                         = module.vpc.private_subnets[0]
  subnet2_id                         = module.vpc.private_subnets[1]

  standard_tags = local.tags
}
h
Oh, sorry wasn't much of a help but glad you had a fix. Also, is the value you are trying to change not configurable on the module level?
c
It is configurable but doesn't get read by
terraform apply
because the registry module is pulled instead of local changes.