Skip to content

Conversation

@svenwb
Copy link

@svenwb svenwb commented Jun 12, 2019

what

removed provider block

why

While using this module a terrform plan always requested to specify the region, although the variable region is set in the module.

provider "aws" {
  assume_role {
    role_arn = "${var.aws_assume_role_arn}"
  }

  region = "${var.region}"
}

module "subnets" {
  source              = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.11.0"
  availability_zones  = ["${data.aws_availability_zones.available.names}"]
  namespace           = "${var.namespace}"
  stage               = "${var.stage}"
  name                = "${var.name}"
  attributes          = "${var.attributes}"
  tags                = "${local.tags}"
  region              = "${var.region}"
  vpc_id              = "${module.vpc.vpc_id}"
  igw_id              = "${module.vpc.igw_id}"
  cidr_block          = "${module.vpc.vpc_cidr_block}"
  nat_gateway_enabled = "true"
}
>terraform plan
provider.aws.region
  The region where AWS operations will take place. Examples
  are us-east-1, us-west-2, etc.

  Default: us-east-1
  Enter a value: 

@svenwb svenwb marked this pull request as ready for review June 12, 2019 05:47
@svenwb
Copy link
Author

svenwb commented Jun 12, 2019

Relates to #56

@osterman
Copy link
Member

@svenwb
Copy link
Author

svenwb commented Jun 17, 2019

@svenwb can you try this instead? https://github.com/cloudposse/terraform-aws-dynamic-subnets/pull/57/files#diff-ef22b8f4f3d3aa4da77d8e2297dbb1fcR74

@osterman thanks that worked for me. I didn't know about that concept in terraform +1

@k911
Copy link
Contributor

k911 commented Jun 17, 2019

@osterman I think this is still necessary fix because if this module is included in other higher level module, it won't work.

Edit2: I'm afraid it will affect end users anyway unless the constraint is changed to use >= syntax. This module will block usage of recent versions of aws provider. @osterman Is it incompatible with 2.14/2.15? I think it worked just fine.

Edit: OK, nevermind, we just have to also add provider inside a higher level module:

# module/main.tf

provider "aws" {}

module "vpc" {
  providers = {
    aws = "aws"
  }
  ...
}

module "dynamic-subnets" {
  providers = {
    aws = "aws"
  }
  ...
}
# terraform.tf

module "network" {
  providers = {
    aws = "aws"
  }
  ...
}

@osterman
Copy link
Member

@svenwb

I'm afraid it will affect end users anyway unless the constraint is changed to use >= syntax

Yes, we are concerned about this too given how quickly the provider revs.

I think we'll start with this and then loosen it as necessary.

@osterman
Copy link
Member

@svenwb will close for now; please re-open or create a new issue if problems arise.

FYI, we merged #57 which adds basic tests

@osterman osterman closed this Jun 18, 2019
@svenwb
Copy link
Author

svenwb commented Jun 20, 2019

Ok cool. Thanks for the feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants