Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jon Duarte
    @jonjpbm
    Good day to everyone
    Jon Duarte
    @jonjpbm
    Let's assume that we have some terraform code that is using a module. And let's assume that the module is using a version tag in the reference.
    If the version tag for the module is updated, is there a way to check the state file or some other means to see what version of the module was used?
    Thank you for any help
    1 reply
    FawenYo
    @FawenYo
    Hi, want to ask how to deal with network_security_group_id with AzureStack v1.0.0 in azurestack_network_interface?
    It seems that the argument is removed with the latest version of AzureStack, but I didn't see any related information.
    Jon Murillo
    @jmurillo9

    I'm trying to use Typescript + CDKTF in a project. I've imported the Resource"function" from cdktf. Whenever I create an S3 bucket, there appears to be a random UUID appended to the resource name (from a statefile perspective).

    Any idea how to debug why? I'd like to remove that..

    2 replies
    Rich Siegel
    @rismoney
    so environment variables (TF_VARS) won't work in modules unless you pass them in via the root module?
    aliahsantech
    @aliahsantech
    image.png
    hello Team, I am receiving this error while executing terraform init
    "Too many command line arguments. Did you mean to use -chdir?"
    Bo @ LBX
    @sb3lbx

    Howdy, y'all.

    I'm thinking through possible solutions for Terraform's "feature" of not planning and applying when it does not understand how many resources need to be created. E.g.:
    The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.

    I understand the design decision probably stems from the plan portion of Terraform's functionality. It makes sense but it is very much a hurdle to teams trying to move the needle in automated infrastructure management.

    I reject the idea of using -target. It only masks the issue and creates the need for human intervention or greater opportunity for human error with deployment scripts that target specific resources. There are clever workarounds to give TF the length of the list prior to knowing the details of the values, and I've used such hacks a lot. However, each time I think, "This is a waste of time." Adding to this, the issue crops up in popular TF modules on a regular basis because people do not know to test thoroughly for this problem or do not care. It eliminates my team's ability to use such modules because we must be able to stand up and tear down environments without human intervention.

    In the past, I have written small Terraform wrappers that gather data for Terraform and either provide that data to Terraform as inputs or straight up generates the Terraform code for it to execute. But there's no point in maintaining a custom and private project for each employer; that's not helpful for the bottom line and its not helpful for the team(s) in the company that have the added burden of custom code to maintain.

    So I have looked for public solutions, either paid or OSS, but have found nothing tenable for my employer. They should not have to learn the nuances of JSONNET or DHALL or similar, and they typically do not know TypeScript for CDKTF. Golang CDKTF thus far is not an option because it adds cognitive overhead, noise and toil with wrapping types for conversions to JSII types. CDKTF also was not GA until this week.

    What is the communities solution to this Terraform shortcoming? The hacks and -target are increasingly a time sink and do not move us towards automated, reliable and self-healing deployments that may be destroyed with ease when needed.

    Nicola Pavlov
    @npavlovatsynamedia
    Hi all.
    I am facing an issue similar to the one in here https://docs.magmacore.org/docs/1.0.0/orc8r/deploy_terraform but with different resource. In my case I have an issue with aws_cloudwatch_metric_alarm. I know that by running terraform apply again, it is solved. But is this the only way?(In short, I am getting an error with terraform apply "...does not correlate with any element in actual").
    axsuul
    @axsuul:matrix.org
    [m]
    Hi there. Is there a way to DRY this up?
    module "app" {
      source = "./imaged"
      node_group = "app"
      name_prefix = "app"
      name_suffix = var.name_suffix
      project = var.project
      zone = var.zone
      source_disk_name = var.source_disk_name
      source_image_name = var.source_image_name
      machine_type = var.app_machine_type
    }
    
    module "pgbouncer" {
      source = "./imaged"
      node_group = "pgbouncer"
      name_prefix = "pgbouncer"
      name_suffix = var.name_suffix
      project = var.project
      zone = var.zone
      source_disk_name = var.source_disk_name
      source_image_name = var.source_image_name
      machine_type = var.pgbouncer_machine_type
    }
    
    module "sidekiq" {
      source = "./imaged"
      node_group = "sidekiq"
      name_prefix = "sidekiq"
      name_suffix = var.name_suffix
      project = var.project
      zone = var.zone
      source_disk_name = var.source_disk_name
      source_image_name = var.source_image_name
      machine_type = var.sidekiq_machine_type
    }
    9 replies
    Basile Chandesris
    @good92
    @sb3lbx Maybe an accessible documentation page dealing with the Why and benefits of the standard TF approach is needed
    4 replies
    Greg Chavez
    @gregmark
    Does anyone know of an available module to setup global RDS clusters? The ones that I've found seem to lack the ability to make the clusters global, but maybe that's a mistaken impression. TIA
    1 reply
    sagarr8130
    @sagarr8130

    Hi everyone,

    I need to add multiple cross zonal GCP instances to UIG. But, below code is attaching only few instances to UIG.

    It is working as expected (creating UIG and attaching instances to terraform created UIG) if var.num_instances count is greater than or equal to length(data.google_compute_zones.available.names).

    But , It does not attach instance in case length(data.google_compute_zones.available.names) is less than var.num_instances.

    `data "google_compute_zones" "available" {
    project = var.project
    region = var.region
    }

    module "google_uig" {
    source = "C:/Users/xxxx/OneDrive/Desktop/New folder/terraform-google-core/modules/compute_engine_uig"
    depends_on = [
    module.google_vm
    ]
    project = var.project

    count = var.num_instances

    count = length(data.google_compute_zones.available.names) < var.num_instances ? length(data.google_compute_zones.available.names) : var.num_instances
    zone = var.zone == null ? data.google_compute_zones.available.names[count.index % length(data.google_compute_zones.available.names)] : var.zone
    name = "use1${[for zone in (data.google_compute_zones.available.names): substr(zone,-1,-1)][count.index]}-oss94-mta99-app-ig01"
    instances = element((module.google_vm[*].google_instance_id), count.index)
    }`

    project = "gcp-test01" region = "us-central1" num_instances = "6" image_project = "gcp-kcfn01" image_name = "centos7-kent-v20220105" instance_name = "kcfn01-cfn01-apoc01-app" tags = ["oss01-mta-app", "usc1-sss-oss-snet01-local"] machine_type = "n1-standard-4" disk_size = "50" disk_type = "pd-standard" boot_disk_size = "50" boot_disk_type = "pd-standard" network = "cfn01-sss-net" subnetwork = "cfn01-usc1-sss-oss-snet01" subnetwork_project = "gcp-kcfn01"

    asd99557
    @asd99557
    A provider configuration block is required in every Terraform configuration.
    Nathan
    @nwmcsween
    so I want to iterate over a list but preserve order, how would I go about doing this with for_each that won't horribly break?
    list is [ $path/$file, ... ]
    chireddy
    @chireddy

    `$ terraform import aws_dynamodb_table.raw-dora raw-dora-prod
    Acquiring state lock. This may take a few moments...
    aws_dynamodb_table.raw-dora: Importing from ID "raw-dora-prod"...
    aws_dynamodb_table.raw-dora: Import prepared!
    Prepared aws_dynamodb_table for import
    aws_dynamodb_table.raw-dora: Refreshing state... [id=raw-dora-prod]

    │ Error: Cannot import non-existent remote object

    │ While attempting to import an existing object to "aws_dynamodb_table.raw-dora", the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct and that it
    │ is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.

    Releasing state lock. This may take a few moments...`

    I am getting this error while trying to import dynamoDB table.
    Here is the Code:
    resource "aws_dynamodb_table" "raw-dora" { name = "raw-dora-${terraform.workspace}

    Any help please?
    vancz
    @xeczt:matrix.org
    [m]
    Does the object with that ID exist?
    I don't know anything about AWS but did you try actually looking at what the error message is complaining about?
    chireddy
    @chireddy
    yeah. The table exists.
    vancz
    @xeczt:matrix.org
    [m]

    This part too?

    is associated with the provider's configured region or endpoint

    chireddy
    @chireddy
    yes
    vancz
    @xeczt:matrix.org
    [m]
    Do you have permission to access it? (IDK how AWS works)
    chireddy
    @chireddy
    yes I do have
    vancz
    @xeczt:matrix.org
    [m]
    Ok, I don't know then, good luck.
    chireddy
    @chireddy
    image.png
    image.png
    wmsan
    @wesleyvicthor
    I have datasource which outputs the kubeconfig.yaml of my cluster. This file is used to set the helm provider kubernetes config_path.
    When I apply a destroy, the file is one of the first to be destroyed. This makes destroy fails in a later step as the kubeconfig is missing.
    How to make `resource "local_file" "kubeconfig" the last item to be destroyed ?
    Brian Gupta
    @bgupta

    Curious about development workflows/timelines. When might this PR be merged and included in a release of the AWS provider? (Our migration to AWS-SSO has been blocked by the lack of this feature.)

    hashicorp/terraform-provider-aws#25915

    axsuul
    @axsuul:matrix.org
    [m]
    ah is it mixing it with dynamic blocks?
    axsuul
    @axsuul:matrix.org
    [m]
    seems like I can't use dynamic at the top level to define modules however
    .-. --- -...
    @pearce_rob_twitter

    i'm trying to allow for a little more than one eks managed node group in the eks module, so i have a data structure in a variable like this

            managed_node_groups = [
              {
                group_name = "small"
                instance_type = "t2.small"
                max_size = 2
                min_size = 1
                desired_size = 1
              },
              {
                group_name = "medium"
                instance_type = "t2.medium"
                max_size = 2
                min_size = 1
                desired_size = 1
              }
            ]

    but in the resource it's a map, not a repeated block (so i dont think i can use a dynamic block, right ?). So what i have now is like this:

    eks_managed_node_groups = {
        "${var.cluster_node_groups[0]["group_name"]}" = {
          subnet_ids   = module.vpc.private_subnets
          min_size     = var.cluster_node_groups[0]["min_size"]
          max_size     = var.cluster_node_groups[0]["max_size"]
          desired_size = var.cluster_node_groups[0]["desired_size"]
          instance_types = [var.cluster_node_groups[0]["instance_type"]]
          capacity_type = "ON_DEMAND"
        }
      }

    but that's obviously just for the first of the two entries. I want to get rid of the [0] and probably have some kind of index.count, or a loop ? I know i'm looking to end up with eks_managed_node_groups = { "small" = {}, "medium" = {}} in terms of its structure. Not sure how i do that in TF, though.

    .-. --- -...
    @pearce_rob_twitter
    alternatively, i can pass it as a map and just reference it directly, but i'd then need to find a way to inject the module.vpc.private_subnets values into that map. Which might be easier ? I dont know.
    .-. --- -...
    @pearce_rob_twitter

    might have figured it out.

    eks_managed_node_groups = {
      for k, v in var.cluster_node_groups:
         (k) => merge ({ subnet_ids = module.vpc.private_subnets }, v)
        }

    seems to be working.

    myname
    @Nayeem0030
    Hi
    facing argument deprecated error while runing terrafrom apply
    1 reply
    axsuul
    @axsuul:matrix.org
    [m]
    I think from your proposed solution it's just one module?
    Nathan
    @nwmcsween
    Hi I'm running into an issue with dep resolution within a provider block, module "xyz" {...} provider "zyx" { something = module.xyz.attr }, the problem is if a resource under module.xyz is deleted or modified the provider block seems to not update
    hezibank
    @hezibank

    Hey all,
    Getting the following error when trying to apply a helm release with a bunch of manifests that exceed 4MB

    The plugin returned an unexpected error from plugin.(*GRPCProvider).PlanResourceChange: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (4196495 vs.
    │ 4194304)

    Would anyone know how to overcome this? using helm provider v2.5.1

    Nathan Thorpe
    @nathanthorpe
    Hey anyone familiar with using modules in tfcdk? I'm trying to pass a different provider into the modules and I'm getting a weird error. The modules just extend the TerraformModule class. The error is
    Warning: Provider aws is undefined
                  │ 
                  │   on cdk.tf.json line 109, in module.sso.providers:
                  │  109:         "aws": "aws.mgmt"
                  │
                  │ Module module.sso does not declare a provider named aws.
            # Setup providers
            mgmt_provider = AwsProvider(
                self,
                "aws_mgmt",
                alias="mgmt",
                profile="sso",
                region="us-west-2",
                default_tags=AwsProviderDefaultTags(
                    tags={
                        "CreatedBy": "Terraform"
                    }
                )
            )
    
            deployment_provider = AwsProvider(
                self,
                "aws_deployment",
                alias="deployment",
                profile="sso-deployment",
                region="us-west-2",
                default_tags=AwsProviderDefaultTags(
                    tags={
                        "CreatedBy": "Terraform"
                    }
                )
            )
    
            # Modules
            StateModule(self, "state", providers=[deployment_provider])
            SSOModule(self, "sso", providers=[mgmt_provider])
    Stephan Stachurski
    @stevesta
    i'm trying to upgrade a terraform codebase and i hit a problem going from 11 to 12, there's a slight difference in one of the modules, and now i'm getting an invalid function argument error from inside a module, this module is pulled in multiple times and i'm not sure which instance is giving the problem
    Stephan Stachurski
    @stevesta
    Error: Invalid function argument
    
      on ../../../modules012/server/alb-attachment.tf line 2, in locals:
       2:   hostname = lookup(var.tags, "hs:alb_hostname", false) != false ? lookup(var.tags, "hs:alb_hostname") : lookup(var.tags, "cluster")
        |----------------
        | var.tags is object with 6 attributes
    
    Invalid value for "inputMap" parameter: the given object has no attribute
    "cluster".
    the error is in the module, but i include the server module 136 times and i'm not sure which of those 136 instances is the problem
    eric-millin
    @eric-millin
    Hi. I have a question specific to AWS Terraform. I'd like to add custom ECS attributes to resources, ie the equivalent of aws ecs put-attributes. I see how to add tags, but not attributes. Can someone point me in the right direction?
    sharonmary
    @sharonmary:matrix.org
    [m]
    Good news
    Put an end to your financial problems,now you can start earning with your PC or mobile phone, PAY INSTANTLY!
    So far I’ve made over €5,500 in last 12days of doing this!(HOW) info inbox me the directly Telegram
    👇👇
    https://t.me/+klV1ANnp3q02YjU0
    Kacper
    @Upgreydd
    error collecting instance settings: couldn't find resource any idea what can be related? :|
    2 replies