MockAttrs constructs and returns a hcl.Attributes map with attributes derived from the given expression map. Each entry in the map becomes an attribute whose name is the key and whose expression is the value.
(exprs map[string]hcl.Expression)
| 346 | // Each entry in the map becomes an attribute whose name is the key and |
| 347 | // whose expression is the value. |
| 348 | func MockAttrs(exprs map[string]hcl.Expression) hcl.Attributes { |
| 349 | ret := make(hcl.Attributes) |
| 350 | for name, expr := range exprs { |
| 351 | ret[name] = &hcl.Attribute{ |
| 352 | Name: name, |
| 353 | Expr: expr, |
| 354 | Range: hcl.Range{ |
| 355 | Filename: "MockAttrs", |
| 356 | }, |
| 357 | NameRange: hcl.Range{ |
| 358 | Filename: "MockAttrs", |
| 359 | }, |
| 360 | } |
| 361 | } |
| 362 | return ret |
| 363 | } |
no outgoing calls