Comments (11)
To avoid this, use the literal ID for the VPC rather than a data source attribute.
from terraform-aws-atlantis.
Data sources should be fine also as long as they are not referring to values which are not known before the execution (eg, VPC should be created before it is discovered using data source).
Good that you found the solution!
from terraform-aws-atlantis.
@antonbabenko I'm seeing data sources failing even when the value is known before the execution
from terraform-aws-atlantis.
$ terraform console
> data.terraform_remote_state.core.vpc_id.test
vpc-0643f5b708f5fb8e1
$ terraform validate
Error: module.atlantis.module.vpc.aws_vpc_ipv4_cidr_block_association.this: 1 error(s) occurred:
* module.atlantis.module.vpc.aws_vpc_ipv4_cidr_block_association.this: element: element() may not be used with an empty list in:
${element(var.secondary_cidr_blocks, count.index)}
Error: module.atlantis.module.vpc.aws_eip.nat: 1 error(s) occurred:
* module.atlantis.module.vpc.aws_eip.nat: element: element() may not be used with an empty list in:
${merge(map("Name", format("%s-%s", var.name, element(var.azs, (var.single_nat_gateway ? 0 : count.index)))), var.tags, var.nat_eip_tags)}
Error: module.atlantis.module.vpc.aws_vpc.this: expected cidr_block to contain a valid CIDR, got: with err: invalid CIDR address
from terraform-aws-atlantis.
Having the same issue
from terraform-aws-atlantis.
@smiller171 @sc250024 Could you please share your configs?
from terraform-aws-atlantis.
Yeah, I'll try to remember on Monday
from terraform-aws-atlantis.
Hi, I'm having the same issue. @bangpound solution works, but I wonder why is this race condition occurring.
My configuration:
module "atlantis" {
source = "terraform-aws-modules/atlantis/aws"
version = "1.16.0"
name = "${var.name}"
# VPC
vpc_id = "${data.terraform_remote_state.us_west_network_vpc_main.vpc_id}"
private_subnet_ids = ["${data.terraform_remote_state.us_west_network_vpc_main.private_subnets}"]
public_subnet_ids = ["${data.terraform_remote_state.us_west_network_vpc_main.public_subnets}"]
# DNS
route53_zone_name = "${data.terraform_remote_state.domain.name}"
certificate_arn = "${data.terraform_remote_state.domain.virginia_certificate_arn}"
# CloudWatch
cloudwatch_log_retention_in_days = 90
# Atlantis GitLab
atlantis_gitlab_hostname = "${var.gitlab_hostname}"
atlantis_gitlab_user = "${var.gitlab_user}"
atlantis_gitlab_user_token = "${var.gitlab_user_token}"
atlantis_gitlab_user_token_ssm_parameter_name = "${local.ssm_base_path}/gitlab/atlantis/user/token"
# Webhook secret
webhook_ssm_parameter_name = "${local.ssm_base_path}/gitlab/atlantis/webhook/secret"
# Allow users to configurate atlantis from their repos
allow_repo_config = "true"
# Required
atlantis_repo_whitelist = "${var.repo_whitelist}"
tags = "${local.common_tags}"
}
from terraform-aws-atlantis.
@antonbabenko Here are the files below. Note that the VPC module is the official one maintained at https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws.
$ terraform version
Terraform v0.11.13
+ provider.aws v2.6.0
+ provider.null v2.1.1
+ provider.random v2.1.1
+ provider.template v2.1.1
main.tf
provider "aws" {
region = "${var.aws_region}"
version = "~> 2.6"
}
provider "null" {
version = "~> 2.1"
}
provider "random" {
version = "~> 2.1"
}
provider "template" {
version = "~> 2.1"
}
########
# Main #
########
module "atlantis" {
atlantis_allowed_repo_names = ["my-terraform-repo"]
atlantis_github_user = "myorggithubuser"
atlantis_github_user_token = "${var.atlantis_github_user_token}"
atlantis_repo_whitelist = ["github.com/myorg/my-terraform-repo"]
atlantis_version = "v0.7.1"
azs = "${data.aws_availability_zones.available.names}"
cloudwatch_log_retention_in_days = 7
create_route53_record = true
private_subnet_ids = "${data.terraform_remote_state.vpc.private_subnets}"
public_subnet_ids = "${data.terraform_remote_state.vpc.public_subnets}"
route53_zone_name = "myorg.net"
source = "terraform-aws-modules/atlantis/aws"
version = "1.16.0"
vpc_id = "${data.terraform_remote_state.vpc.vpc_id}"
}
data.tf
data "aws_availability_zones" "available" {}
data "terraform_remote_state" "vpc" {
backend = "s3"
config {
bucket = "pb-euw1-prod-s3-terraform-state"
key = "aws/prod/${var.aws_region}/vpc/terraform.tfstate"
region = "eu-west-1"
}
}
vars.tf
variable "aws_region" {
default = "eu-west-1"
type = "string"
}
variable "atlantis_github_user_token" {
description = "GitHub token of the user that is running the Atlantis command"
type = "string"
}
from terraform-aws-atlantis.
I think there's an issue going on here specifically with terraform_remote_state
from terraform-aws-atlantis.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
from terraform-aws-atlantis.
Related Issues (20)
- Invalid index in module "ecs_service" in v 4.0.1 HOT 3
- security_group_egress_rules uses wrong input HOT 2
- Missing secretsmanager:GetSecretValue policy action HOT 2
- ATLANTIS_ATLANTIS_URL not correctly picked up from atlantis.fqdn HOT 3
- Allow custom ALB Security Group rules HOT 7
- Job details lost after re-deployment HOT 2
- Document that setting ATLANTIS_GH_USER breaks the github app (ATLANTIS_GH_APP_ID / ATLANTIS_GH_APP_KEY) scenario HOT 2
- Atlantis default UID of 100 vs 1000 HOT 2
- Redeploying fargate atlantis task always breaks HOT 6
- atlantis_repo_allowlist format for Atlantis and the github_repository_webhooks HOT 2
- Do we need to call github_organization_webhook instead of github_repository_webhook for * ? HOT 1
- When EFS is Enabled, the Created EFS File System has an empty 'Name' Tag HOT 2
- The ALB Target Group Name is not set to the 'name' Variable HOT 2
- No possibility to pass a created SG for Atlantis ALB to ECS Service if we set var.create_alb = true, and var.alb.create_security_group = false HOT 1
- Just curious how to allow atlantis to comment on Bitbucket PRs using this tf module. HOT 3
- (re-open #384) atlantis_repo_allowlist format for Atlantis and the github_repository_webhooks HOT 4
- "Encountering 'Unsupported attribute' Errors with OIDC Configuration in AWS LB Listener" HOT 1
- Issues with ACM Certificate Validation Timeout and ECS Service Creation Due to Target Group Association HOT 7
- Secret manager version reported changes HOT 3
- Political ware breaks Atlantis module HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-aws-atlantis.