Giter Site home page Giter Site logo

Comments (4)

joestump avatar joestump commented on July 26, 2024

Having this resource replicate the aws_security_group_rule would require the API endpoint to be rewritten by our friends at Heroku because as you mention the API overwrites/replaces rulesets.

The good news is that you can pass a list to HCL blocks. This is some example code I came up with for another person looking for similar behavior:

provider "heroku" {}

resource "heroku_space" "foobar" {
  name         = "joe-testing-1"
  organization = "my-team"
  region       = "virginia"
}

locals {
  prd = [
    {
      action = "allow"
      source = "8.8.8.8/32"
    }
  ]

  vpn = [
    {
      action = "allow"
      source = "8.8.4.4/32"
    }
  ]

  space = [
    {
      action = "allow"
      source = "${heroku_space.foobar.outbound_ips[0]}/32"
    },
    {
      action = "allow"
      source = "${heroku_space.foobar.outbound_ips[1]}/32"
    },
    {
      action = "allow"
      source = "${heroku_space.foobar.outbound_ips[2]}/32"
    },
    {
      action = "allow"
      source = "${heroku_space.foobar.outbound_ips[3]}/32"
    }
  ]
}

resource "heroku_space_inbound_ruleset" "lock_space_to_itself" {
  space = "${heroku_space.foobar.id}"
  rule = ["${local.prd}"]
  rule = ["${local.vpn}"]
  rule = ["${local.space}"]
}

from terraform-provider-heroku.

joestump avatar joestump commented on July 26, 2024

TL;DR you can pass lists of maps into an HCL block and it'll just work.

from terraform-provider-heroku.

talbright avatar talbright commented on July 26, 2024

Helpful suggestion! I'll try this out. There's an additional axis here, that is my space has a count so that introduces splat syntax.

It's not strictly true that support for this would require a Heroku API change. One would have to get the rules via the api, and do some comparisons, then send the set back.

from terraform-provider-heroku.

talbright avatar talbright commented on July 26, 2024

This didn't end up working for me, so I just used the older deprecated trusted_ip_ranges

from terraform-provider-heroku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.